Skip to content

Commit ae052ed

Browse files
feat(pdu): improve ExtendedClientOptionalInfoBuilder API (#891)
1 parent f30bb99 commit ae052ed

1 file changed

Lines changed: 16 additions & 6 deletions

File tree

crates/ironrdp-pdu/src/rdp/client_info.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -272,10 +272,7 @@ impl ExtendedClientOptionalInfo {
272272
/// Creates a new builder for [`ExtendedClientOptionalInfo`].
273273
pub fn builder(
274274
) -> builder::ExtendedClientOptionalInfoBuilder<builder::ExtendedClientOptionalInfoBuilderStateSetTimeZone> {
275-
builder::ExtendedClientOptionalInfoBuilder::<builder::ExtendedClientOptionalInfoBuilderStateSetTimeZone> {
276-
inner: Self::default(),
277-
_phantom_data: Default::default(),
278-
}
275+
builder::ExtendedClientOptionalInfoBuilder::<builder::ExtendedClientOptionalInfoBuilderStateSetTimeZone>::default()
279276
}
280277

281278
pub fn timezone(&self) -> Option<&TimezoneInfo> {
@@ -731,8 +728,8 @@ pub mod builder {
731728
// setting the next one, therefore we use a state machine to enforce this during the compile time.
732729
#[derive(Debug, Clone, PartialEq, Eq)]
733730
pub struct ExtendedClientOptionalInfoBuilder<State> {
734-
pub(super) inner: ExtendedClientOptionalInfo,
735-
pub(super) _phantom_data: PhantomData<State>,
731+
inner: ExtendedClientOptionalInfo,
732+
_phantom_data: PhantomData<State>,
736733
}
737734

738735
impl<State> ExtendedClientOptionalInfoBuilder<State> {
@@ -742,6 +739,13 @@ pub mod builder {
742739
}
743740

744741
impl ExtendedClientOptionalInfoBuilder<ExtendedClientOptionalInfoBuilderStateSetTimeZone> {
742+
pub fn new() -> Self {
743+
Self {
744+
inner: ExtendedClientOptionalInfo::default(),
745+
_phantom_data: Default::default(),
746+
}
747+
}
748+
745749
pub fn timezone(
746750
mut self,
747751
timezone: TimezoneInfo,
@@ -754,6 +758,12 @@ pub mod builder {
754758
}
755759
}
756760

761+
impl Default for ExtendedClientOptionalInfoBuilder<ExtendedClientOptionalInfoBuilderStateSetTimeZone> {
762+
fn default() -> Self {
763+
Self::new()
764+
}
765+
}
766+
757767
impl ExtendedClientOptionalInfoBuilder<ExtendedClientOptionalInfoBuilderStateSetSessionId> {
758768
pub fn session_id(
759769
mut self,

0 commit comments

Comments
 (0)