pub struct WriteReqBuilder<P, const F: usize = 0> { /* private fields */ }Expand description
Streaming builder for a WriteRequestMessage. Type-state-tagged
so the compiler enforces in-order field writes. Optional fields
are implicitly skipped by simply not calling their setter —
later-field setters are available on all earlier states.
Field-state values (the state after each named field has been written or implicitly skipped):
0: nothing written yet1: pastSuppressResponse(written or skipped)2: pastTimedRequest3: pastWriteRequestsarray (closed)4: pastMoreChunkedMessages5: pastInteractionModelRevision(auto-injected at default valueIM_REVISIONbyend()if the optional setter wasn’t called)
In practice almost every call is WriteReqBuilder::new(p)? .write_requests()? … .end()? — SuppressResponse and
MoreChunkedMessages default to absent (= false on the wire),
TimedRequest is only set when issuing a timed write.
Implementations§
Source§impl<P> WriteReqBuilder<P>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P>where
P: TLVBuilderParent,
Source§impl<P> WriteReqBuilder<P>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P>where
P: TLVBuilderParent,
Sourcepub fn suppress_response(
self,
value: bool,
) -> Result<WriteReqBuilder<P, 1>, Error>
pub fn suppress_response( self, value: bool, ) -> Result<WriteReqBuilder<P, 1>, Error>
Write the optional SuppressResponse field. Omit (don’t call)
to leave the field absent on the wire.
Source§impl<P> WriteReqBuilder<P>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P>where
P: TLVBuilderParent,
Sourcepub fn timed_request(self, value: bool) -> Result<WriteReqBuilder<P, 2>, Error>
pub fn timed_request(self, value: bool) -> Result<WriteReqBuilder<P, 2>, Error>
Write the optional TimedRequest field. Calling this from
state 0 implicitly skips SuppressResponse.
Source§impl<P> WriteReqBuilder<P, 1>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P, 1>where
P: TLVBuilderParent,
Sourcepub fn timed_request(self, value: bool) -> Result<WriteReqBuilder<P, 2>, Error>
pub fn timed_request(self, value: bool) -> Result<WriteReqBuilder<P, 2>, Error>
Write the optional TimedRequest field.
Source§impl<P> WriteReqBuilder<P>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P>where
P: TLVBuilderParent,
Sourcepub fn write_requests(
self,
) -> Result<AttrDataArrayBuilder<WriteReqBuilder<P, 3>>, Error>
pub fn write_requests( self, ) -> Result<AttrDataArrayBuilder<WriteReqBuilder<P, 3>>, Error>
Open the WriteRequests array. Calling from state 0
implicitly skips both SuppressResponse and TimedRequest.
Source§impl<P> WriteReqBuilder<P, 1>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P, 1>where
P: TLVBuilderParent,
Sourcepub fn write_requests(
self,
) -> Result<AttrDataArrayBuilder<WriteReqBuilder<P, 3>>, Error>
pub fn write_requests( self, ) -> Result<AttrDataArrayBuilder<WriteReqBuilder<P, 3>>, Error>
Open the WriteRequests array, implicitly skipping TimedRequest.
Source§impl<P> WriteReqBuilder<P, 2>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P, 2>where
P: TLVBuilderParent,
Sourcepub fn write_requests(
self,
) -> Result<AttrDataArrayBuilder<WriteReqBuilder<P, 3>>, Error>
pub fn write_requests( self, ) -> Result<AttrDataArrayBuilder<WriteReqBuilder<P, 3>>, Error>
Open the WriteRequests array. Each .push() on the returned
builder starts one AttrData entry; close with .end() to
return to the message builder.
Source§impl<P> WriteReqBuilder<P, 3>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P, 3>where
P: TLVBuilderParent,
Sourcepub fn more_chunks(self, value: bool) -> Result<WriteReqBuilder<P, 4>, Error>
pub fn more_chunks(self, value: bool) -> Result<WriteReqBuilder<P, 4>, Error>
Write the optional MoreChunkedMessages field. Omit (don’t
call — go straight to .end()) for single-chunk writes.
Source§impl<P> WriteReqBuilder<P, 3>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P, 3>where
P: TLVBuilderParent,
Source§impl<P> WriteReqBuilder<P, 3>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P, 3>where
P: TLVBuilderParent,
Sourcepub fn interaction_model_revision(
self,
value: u8,
) -> Result<WriteReqBuilder<P, 5>, Error>
pub fn interaction_model_revision( self, value: u8, ) -> Result<WriteReqBuilder<P, 5>, Error>
Write InteractionModelRevision, implicitly skipping
MoreChunkedMessages. This is a typestate skip-shim mirroring
the pattern PR #447 established for SuppressResponse /
TimedRequest on InvReqBuilder: callers who don’t populate
the optional preceding field can advance straight to setting
(or auto-injecting) InteractionModelRevision without an
explicit no-op transition.
Source§impl<P> WriteReqBuilder<P, 4>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P, 4>where
P: TLVBuilderParent,
Sourcepub fn interaction_model_revision(
self,
value: u8,
) -> Result<WriteReqBuilder<P, 5>, Error>
pub fn interaction_model_revision( self, value: u8, ) -> Result<WriteReqBuilder<P, 5>, Error>
Write the mandatory-on-the-wire InteractionModelRevision
field (Matter Core: value is 13 since Matter
1.3, unchanged in 1.4 and 1.5). Optional at the API level —
omit and end() injects IM_REVISION automatically.
Sourcepub fn end(self) -> Result<P, Error>
pub fn end(self) -> Result<P, Error>
Close the message struct, auto-injecting
InteractionModelRevision at its default value
IM_REVISION. Returns the parent.
Source§impl<P> WriteReqBuilder<P, 5>where
P: TLVBuilderParent,
impl<P> WriteReqBuilder<P, 5>where
P: TLVBuilderParent,
Trait Implementations§
Source§impl<P> TLVBuilder<P> for WriteReqBuilder<P>where
P: TLVBuilderParent,
impl<P> TLVBuilder<P> for WriteReqBuilder<P>where
P: TLVBuilderParent,
Source§impl<P, const F: usize> TLVBuilderParent for WriteReqBuilder<P, F>where
P: TLVBuilderParent,
impl<P, const F: usize> TLVBuilderParent for WriteReqBuilder<P, F>where
P: TLVBuilderParent,
Source§type Write = <P as TLVBuilderParent>::Write
type Write = <P as TLVBuilderParent>::Write
Source§fn writer(&mut self) -> &mut <WriteReqBuilder<P, F> as TLVBuilderParent>::Write
fn writer(&mut self) -> &mut <WriteReqBuilder<P, F> as TLVBuilderParent>::Write
Auto Trait Implementations§
impl<P, const F: usize> Freeze for WriteReqBuilder<P, F>where
P: Freeze,
impl<P, const F: usize> RefUnwindSafe for WriteReqBuilder<P, F>where
P: RefUnwindSafe,
impl<P, const F: usize> Send for WriteReqBuilder<P, F>where
P: Send,
impl<P, const F: usize> Sync for WriteReqBuilder<P, F>where
P: Sync,
impl<P, const F: usize> Unpin for WriteReqBuilder<P, F>where
P: Unpin,
impl<P, const F: usize> UnsafeUnpin for WriteReqBuilder<P, F>where
P: UnsafeUnpin,
impl<P, const F: usize> UnwindSafe for WriteReqBuilder<P, F>where
P: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more