pub struct InCommandBuf { /* private fields */ }Implementations§
Source§impl InCommandBuf
impl InCommandBuf
Sourcepub fn new<__Fcontent>(data: Vec<u8>, content: __Fcontent) -> Self
pub fn new<__Fcontent>(data: Vec<u8>, content: __Fcontent) -> Self
Create a new instance of the rental struct.
The first argument provided is the head, followed by a series of closures, one for each tail field. Each of these closures will receive, as its arguments, a borrow of the previous field, followed by borrows of the remaining prefix fields if the struct is a shared rental. If the struct is a mutable rental, only the immediately preceding field is passed.
Sourcepub fn try_new<__Fcontent, __E>(
data: Vec<u8>,
content: __Fcontent,
) -> RentalResult<Self, __E, Vec<u8>>
pub fn try_new<__Fcontent, __E>( data: Vec<u8>, content: __Fcontent, ) -> RentalResult<Self, __E, Vec<u8>>
Attempt to create a new instance of the rental struct.
As new, but each closure returns a Result. If one of them fails, execution is short-circuited and a tuple of the error and the original head value is returned to you.
Sourcepub fn try_new_or_drop<__Fcontent, __E>(
data: Vec<u8>,
content: __Fcontent,
) -> Result<Self, __E>
pub fn try_new_or_drop<__Fcontent, __E>( data: Vec<u8>, content: __Fcontent, ) -> Result<Self, __E>
Attempt to create a new instance of the rental struct.
As try_new, but only the error value is returned upon failure; the head value is dropped. This method interacts more smoothly with existing error conversions.
Sourcepub unsafe fn all_erased(&self) -> <Self as Rental2<'_, '_>>::Borrow
pub unsafe fn all_erased(&self) -> <Self as Rental2<'_, '_>>::Borrow
Return lifetime-erased shared borrows of the fields of the struct.
This is unsafe because the erased lifetimes are fake. Use this only if absolutely necessary and be very mindful of what the true lifetimes are.
Sourcepub unsafe fn all_mut_erased(&mut self) -> <Self as Rental2<'_, '_>>::BorrowMut
pub unsafe fn all_mut_erased(&mut self) -> <Self as Rental2<'_, '_>>::BorrowMut
Return a lifetime-erased mutable borrow of the suffix of the struct.
This is unsafe because the erased lifetimes are fake. Use this only if absolutely necessary and be very mindful of what the true lifetimes are.
Sourcepub fn rent<__F, __R>(&self, f: __F) -> __R
pub fn rent<__F, __R>(&self, f: __F) -> __R
Execute a closure on the shared suffix of the struct.
The closure may return any value not bounded by one of the special rental lifetimes of the struct.
Sourcepub fn rent_mut<__F, __R>(&mut self, f: __F) -> __R
pub fn rent_mut<__F, __R>(&mut self, f: __F) -> __R
Execute a closure on the mutable suffix of the struct.
The closure may return any value not bounded by one of the special rental lifetimes of the struct.
Sourcepub fn ref_rent<__F, __R>(&self, f: __F) -> &__R
pub fn ref_rent<__F, __R>(&self, f: __F) -> &__R
Return a shared reference from the shared suffix of the struct.
This is a subtle variation of rent where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Sourcepub fn maybe_ref_rent<__F, __R>(&self, f: __F) -> Option<&__R>where
__F: for<'content, 'data> FnOnce(&'content InCommand<'data>) -> Option<&'content __R>,
__R: ?Sized,
pub fn maybe_ref_rent<__F, __R>(&self, f: __F) -> Option<&__R>where
__F: for<'content, 'data> FnOnce(&'content InCommand<'data>) -> Option<&'content __R>,
__R: ?Sized,
Optionally return a shared reference from the shared suffix of the struct.
This is a subtle variation of rent where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Sourcepub fn try_ref_rent<__F, __R, __E>(&self, f: __F) -> Result<&__R, __E>where
__F: for<'content, 'data> FnOnce(&'content InCommand<'data>) -> Result<&'content __R, __E>,
__R: ?Sized,
pub fn try_ref_rent<__F, __R, __E>(&self, f: __F) -> Result<&__R, __E>where
__F: for<'content, 'data> FnOnce(&'content InCommand<'data>) -> Result<&'content __R, __E>,
__R: ?Sized,
Try to return a shared reference from the shared suffix of the struct, or an error on failure.
This is a subtle variation of rent where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Sourcepub fn ref_rent_mut<__F, __R>(&mut self, f: __F) -> &mut __Rwhere
__F: for<'content, 'data> FnOnce(&'content mut InCommand<'data>) -> &'content mut __R,
__R: ?Sized,
pub fn ref_rent_mut<__F, __R>(&mut self, f: __F) -> &mut __Rwhere
__F: for<'content, 'data> FnOnce(&'content mut InCommand<'data>) -> &'content mut __R,
__R: ?Sized,
Return a mutable reference from the mutable suffix of the struct.
This is a subtle variation of rent_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Sourcepub fn maybe_ref_rent_mut<__F, __R>(&mut self, f: __F) -> Option<&mut __R>where
__F: for<'content, 'data> FnOnce(&'content mut InCommand<'data>) -> Option<&'content mut __R>,
__R: ?Sized,
pub fn maybe_ref_rent_mut<__F, __R>(&mut self, f: __F) -> Option<&mut __R>where
__F: for<'content, 'data> FnOnce(&'content mut InCommand<'data>) -> Option<&'content mut __R>,
__R: ?Sized,
Optionally return a mutable reference from the mutable suffix of the struct.
This is a subtle variation of rent_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Sourcepub fn try_ref_rent_mut<__F, __R, __E>(
&mut self,
f: __F,
) -> Result<&mut __R, __E>where
__F: for<'content, 'data> FnOnce(&'content mut InCommand<'data>) -> Result<&'content mut __R, __E>,
__R: ?Sized,
pub fn try_ref_rent_mut<__F, __R, __E>(
&mut self,
f: __F,
) -> Result<&mut __R, __E>where
__F: for<'content, 'data> FnOnce(&'content mut InCommand<'data>) -> Result<&'content mut __R, __E>,
__R: ?Sized,
Try to return a mutable reference from the mutable suffix of the struct, or an error on failure.
This is a subtle variation of rent_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Source§impl InCommandBuf
impl InCommandBuf
Sourcepub fn head(&self) -> &<Vec<u8> as Deref>::Target ⓘ
pub fn head(&self) -> &<Vec<u8> as Deref>::Target ⓘ
Return a shared reference to the head field of the struct.
Sourcepub fn rent_all<__F, __R>(&self, f: __F) -> __Rwhere
__F: for<'data, 'content> FnOnce(InCommandBuf_Borrow<'data, 'content>) -> __R,
__R:,
pub fn rent_all<__F, __R>(&self, f: __F) -> __Rwhere
__F: for<'data, 'content> FnOnce(InCommandBuf_Borrow<'data, 'content>) -> __R,
__R:,
Execute a closure on shared borrows of the fields of the struct.
The closure may return any value not bounded by one of the special rental lifetimes of the struct.
Sourcepub fn ref_rent_all<__F, __R>(&self, f: __F) -> &__Rwhere
__F: for<'data, 'content> FnOnce(InCommandBuf_Borrow<'data, 'content>) -> &'content __R,
__R: ?Sized,
pub fn ref_rent_all<__F, __R>(&self, f: __F) -> &__Rwhere
__F: for<'data, 'content> FnOnce(InCommandBuf_Borrow<'data, 'content>) -> &'content __R,
__R: ?Sized,
Return a shared reference from shared borrows of the fields of the struct.
This is a subtle variation of rent_all where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Sourcepub fn maybe_ref_rent_all<__F, __R>(&self, f: __F) -> Option<&__R>where
__F: for<'data, 'content> FnOnce(InCommandBuf_Borrow<'data, 'content>) -> Option<&'content __R>,
__R: ?Sized,
pub fn maybe_ref_rent_all<__F, __R>(&self, f: __F) -> Option<&__R>where
__F: for<'data, 'content> FnOnce(InCommandBuf_Borrow<'data, 'content>) -> Option<&'content __R>,
__R: ?Sized,
Optionally return a shared reference from shared borrows of the fields of the struct.
This is a subtle variation of rent_all where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Sourcepub fn try_ref_rent_all<__F, __R, __E>(&self, f: __F) -> Result<&__R, __E>where
__F: for<'data, 'content> FnOnce(InCommandBuf_Borrow<'data, 'content>) -> Result<&'content __R, __E>,
__R: ?Sized,
pub fn try_ref_rent_all<__F, __R, __E>(&self, f: __F) -> Result<&__R, __E>where
__F: for<'data, 'content> FnOnce(InCommandBuf_Borrow<'data, 'content>) -> Result<&'content __R, __E>,
__R: ?Sized,
Try to return a shared reference from shared borrows of the fields of the struct, or an error on failure.
This is a subtle variation of rent_all where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Sourcepub fn rent_all_mut<__F, __R>(&mut self, f: __F) -> __Rwhere
__F: for<'data, 'content> FnOnce(InCommandBuf_BorrowMut<'data, 'content>) -> __R,
__R:,
pub fn rent_all_mut<__F, __R>(&mut self, f: __F) -> __Rwhere
__F: for<'data, 'content> FnOnce(InCommandBuf_BorrowMut<'data, 'content>) -> __R,
__R:,
Execute a closure on shared borrows of the prefix fields and a mutable borrow of the suffix field of the struct.
The closure may return any value not bounded by one of the special rental lifetimes of the struct.
Sourcepub fn ref_rent_all_mut<__F, __R>(&mut self, f: __F) -> &mut __Rwhere
__F: for<'data, 'content> FnOnce(InCommandBuf_BorrowMut<'data, 'content>) -> &'content mut __R,
__R: ?Sized,
pub fn ref_rent_all_mut<__F, __R>(&mut self, f: __F) -> &mut __Rwhere
__F: for<'data, 'content> FnOnce(InCommandBuf_BorrowMut<'data, 'content>) -> &'content mut __R,
__R: ?Sized,
Return a mutable reference from shared borrows of the prefix fields and a mutable borrow of the suffix field of the struct.
This is a subtle variation of rent_all_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Sourcepub fn maybe_ref_rent_all_mut<__F, __R>(&mut self, f: __F) -> Option<&mut __R>where
__F: for<'data, 'content> FnOnce(InCommandBuf_BorrowMut<'data, 'content>) -> Option<&'content mut __R>,
__R: ?Sized,
pub fn maybe_ref_rent_all_mut<__F, __R>(&mut self, f: __F) -> Option<&mut __R>where
__F: for<'data, 'content> FnOnce(InCommandBuf_BorrowMut<'data, 'content>) -> Option<&'content mut __R>,
__R: ?Sized,
Optionally return a mutable reference from shared borrows of the prefix fields and a mutable borrow of the suffix field of the struct.
This is a subtle variation of rent_all_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Sourcepub fn try_ref_rent_all_mut<__F, __R, __E>(
&mut self,
f: __F,
) -> Result<&mut __R, __E>where
__F: for<'data, 'content> FnOnce(InCommandBuf_BorrowMut<'data, 'content>) -> Result<&'content mut __R, __E>,
__R: ?Sized,
pub fn try_ref_rent_all_mut<__F, __R, __E>(
&mut self,
f: __F,
) -> Result<&mut __R, __E>where
__F: for<'data, 'content> FnOnce(InCommandBuf_BorrowMut<'data, 'content>) -> Result<&'content mut __R, __E>,
__R: ?Sized,
Try to return a mutable reference from shared borrows of the prefix fields and a mutable borrow of the suffix field of the struct, or an error on failure.
This is a subtle variation of rent_all_mut where it is legal to return a reference bounded by a rental lifetime, because that lifetime is reborrowed away before it is returned to you.
Source§impl InCommandBuf
impl InCommandBuf
Sourcepub fn all<'__s>(&'__s self) -> <Self as Rental2<'_, '_>>::Borrow
pub fn all<'__s>(&'__s self) -> <Self as Rental2<'_, '_>>::Borrow
Borrow all fields of the struct by reborrowing away the rental lifetimes.
This is safe because the lifetimes are verified to be covariant first.
Sourcepub fn suffix(
&self,
) -> <<Self as Rental2<'_, '_>>::Borrow as IntoSuffix>::Suffix
pub fn suffix( &self, ) -> <<Self as Rental2<'_, '_>>::Borrow as IntoSuffix>::Suffix
Borrow the suffix field of the struct by reborrowing away the rental lifetimes.
This is safe because the lifetimes are verified to be covariant first.