pub struct ProtocolMessageGuardAsyncSendTryBuilder<InnerBuilder_: for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + Send + 'this>>, Error_> {
pub buffer: Bytes,
pub inner_builder: InnerBuilder_,
}Expand description
A more verbose but stable way to construct self-referencing structs. It is comparable to using StructName { field1: value1, field2: value2 } rather than StructName::new(value1, value2). This has the dual benefit of making your code both easier to refactor and more readable. Call try_build() or try_build_or_recover() to construct the actual struct. The fields of this struct should be used as follows:
| Field | Suggested Use |
|---|---|
buffer | Directly pass in the value this field should contain |
inner_builder | Use a function or closure: (buffer: &_) -> Result<inner: _, Error_> |
Fields§
§buffer: Bytes§inner_builder: InnerBuilder_Implementations§
Source§impl<InnerBuilder_: for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + Send + 'this>>, Error_> ProtocolMessageGuardAsyncSendTryBuilder<InnerBuilder_, Error_>
impl<InnerBuilder_: for<'this> FnOnce(&'this Bytes) -> Pin<Box<dyn Future<Output = Result<ProtocolMessage<'this>, Error_>> + Send + 'this>>, Error_> ProtocolMessageGuardAsyncSendTryBuilder<InnerBuilder_, Error_>
Sourcepub async fn try_build(self) -> Result<ProtocolMessageGuard, Error_>
pub async fn try_build(self) -> Result<ProtocolMessageGuard, Error_>
Calls ProtocolMessageGuard::try_new() using the provided values. This is preferable over calling try_new() directly for the reasons listed above.
Sourcepub async fn try_build_or_recover(
self,
) -> Result<ProtocolMessageGuard, (Error_, Heads)>
pub async fn try_build_or_recover( self, ) -> Result<ProtocolMessageGuard, (Error_, Heads)>
Calls ProtocolMessageGuard::try_new_or_recover() using the provided values. This is preferable over calling try_new_or_recover() directly for the reasons listed above.
Auto Trait Implementations§
impl<InnerBuilder_, Error_> !Freeze for ProtocolMessageGuardAsyncSendTryBuilder<InnerBuilder_, Error_>
impl<InnerBuilder_, Error_> RefUnwindSafe for ProtocolMessageGuardAsyncSendTryBuilder<InnerBuilder_, Error_>where
InnerBuilder_: RefUnwindSafe,
impl<InnerBuilder_, Error_> Send for ProtocolMessageGuardAsyncSendTryBuilder<InnerBuilder_, Error_>where
InnerBuilder_: Send,
impl<InnerBuilder_, Error_> Sync for ProtocolMessageGuardAsyncSendTryBuilder<InnerBuilder_, Error_>where
InnerBuilder_: Sync,
impl<InnerBuilder_, Error_> Unpin for ProtocolMessageGuardAsyncSendTryBuilder<InnerBuilder_, Error_>where
InnerBuilder_: Unpin,
impl<InnerBuilder_, Error_> UnwindSafe for ProtocolMessageGuardAsyncSendTryBuilder<InnerBuilder_, Error_>where
InnerBuilder_: 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
Mutably borrows from an owned value. Read more