pub trait AttachedUtils: Sized + Sealed {
type Main;
type Attachment;
Show 20 methods
// Required methods
fn main(&self) -> &Self::Main;
fn main_mut(&mut self) -> &mut Self::Main;
fn attachment(&self) -> &Self::Attachment;
fn attachment_mut(&mut self) -> &mut Self::Attachment;
fn into_tuple(self) -> (Self::Main, Self::Attachment);
fn tuple_mut(&mut self) -> (&mut Self::Main, &mut Self::Attachment);
// Provided methods
fn into_main(self) -> Self::Main { ... }
fn copy_attachment(&self) -> Self::Attachment
where Self::Attachment: Copy { ... }
fn clone_attachment(&self) -> Self::Attachment
where Self::Attachment: Clone { ... }
fn map<F, Y>(self, f: F) -> Attached<Y, Self::Attachment>
where F: FnOnce(Self::Main) -> Y { ... }
fn flatten(
self,
) -> Attached<<Self::Main as AttachedUtils>::Main, (Self::Attachment, <Self::Main as AttachedUtils>::Attachment)>
where Self::Main: AttachedUtils { ... }
fn transpose(
self,
) -> Attached<Attached<<Self::Main as AttachedUtils>::Main, Self::Attachment>, <Self::Main as AttachedUtils>::Attachment>
where Self::Main: AttachedUtils { ... }
fn as_deref(&self) -> Attached<&Self::Main, &Self::Attachment> { ... }
fn as_deref_mut(
&mut self,
) -> Attached<&mut Self::Main, &mut Self::Attachment> { ... }
fn copied(self) -> Attached<<Self::Main as Deref>::Target, Self::Attachment>
where Self::Main: Deref<Target: Copy> { ... }
fn cloned(self) -> Attached<<Self::Main as Deref>::Target, Self::Attachment>
where Self::Main: Deref<Target: Clone> { ... }
fn copied_attachment(
self,
) -> Attached<Self::Main, <Self::Attachment as Deref>::Target>
where Self::Attachment: Deref<Target: Copy> { ... }
fn cloned_attachment(
self,
) -> Attached<Self::Main, <Self::Attachment as Deref>::Target>
where Self::Attachment: Deref<Target: Clone> { ... }
fn replace(&mut self, main: Self::Main) -> Self::Main { ... }
fn replace_attachment(
&mut self,
attachment: Self::Attachment,
) -> Self::Attachment { ... }
}Expand description
Methods to interact with Attached.
Required Associated Types§
Sourcetype Attachment
type Attachment
Attached metadata.
Required Methods§
Sourcefn attachment(&self) -> &Self::Attachment
fn attachment(&self) -> &Self::Attachment
Get an immutable reference to the attached metadata.
Sourcefn attachment_mut(&mut self) -> &mut Self::Attachment
fn attachment_mut(&mut self) -> &mut Self::Attachment
Get a mutable reference to the attached data.
Sourcefn into_tuple(self) -> (Self::Main, Self::Attachment)
fn into_tuple(self) -> (Self::Main, Self::Attachment)
Separate the main data from the attached metadata.
Sourcefn tuple_mut(&mut self) -> (&mut Self::Main, &mut Self::Attachment)
fn tuple_mut(&mut self) -> (&mut Self::Main, &mut Self::Attachment)
Get two mutable reference to the main data and the attached metadata.
Provided Methods§
Sourcefn copy_attachment(&self) -> Self::Attachmentwhere
Self::Attachment: Copy,
fn copy_attachment(&self) -> Self::Attachmentwhere
Self::Attachment: Copy,
Get a copy of the attached metadata.
Sourcefn clone_attachment(&self) -> Self::Attachmentwhere
Self::Attachment: Clone,
fn clone_attachment(&self) -> Self::Attachmentwhere
Self::Attachment: Clone,
Get a clone of the attached metadata.
Sourcefn map<F, Y>(self, f: F) -> Attached<Y, Self::Attachment>
fn map<F, Y>(self, f: F) -> Attached<Y, Self::Attachment>
Map the main data.
Sourcefn flatten(
self,
) -> Attached<<Self::Main as AttachedUtils>::Main, (Self::Attachment, <Self::Main as AttachedUtils>::Attachment)>where
Self::Main: AttachedUtils,
fn flatten(
self,
) -> Attached<<Self::Main as AttachedUtils>::Main, (Self::Attachment, <Self::Main as AttachedUtils>::Attachment)>where
Self::Main: AttachedUtils,
Flatten a pair with nested main.
Sourcefn transpose(
self,
) -> Attached<Attached<<Self::Main as AttachedUtils>::Main, Self::Attachment>, <Self::Main as AttachedUtils>::Attachment>where
Self::Main: AttachedUtils,
fn transpose(
self,
) -> Attached<Attached<<Self::Main as AttachedUtils>::Main, Self::Attachment>, <Self::Main as AttachedUtils>::Attachment>where
Self::Main: AttachedUtils,
Swap inner and outer attachment types of a pair with nested main.
Sourcefn as_deref(&self) -> Attached<&Self::Main, &Self::Attachment>
fn as_deref(&self) -> Attached<&Self::Main, &Self::Attachment>
Convert an immutable reference of a whole pair to an owned pair of immutable references.
Sourcefn as_deref_mut(&mut self) -> Attached<&mut Self::Main, &mut Self::Attachment>
fn as_deref_mut(&mut self) -> Attached<&mut Self::Main, &mut Self::Attachment>
Convert a mutable reference of a whole pair to an owned pair of mutable references.
Sourcefn copied(self) -> Attached<<Self::Main as Deref>::Target, Self::Attachment>
fn copied(self) -> Attached<<Self::Main as Deref>::Target, Self::Attachment>
Copy the bits of the main data.
Sourcefn cloned(self) -> Attached<<Self::Main as Deref>::Target, Self::Attachment>
fn cloned(self) -> Attached<<Self::Main as Deref>::Target, Self::Attachment>
Clone the main data.
Sourcefn copied_attachment(
self,
) -> Attached<Self::Main, <Self::Attachment as Deref>::Target>
fn copied_attachment( self, ) -> Attached<Self::Main, <Self::Attachment as Deref>::Target>
Copy the bits of the attached metadata.
Sourcefn cloned_attachment(
self,
) -> Attached<Self::Main, <Self::Attachment as Deref>::Target>
fn cloned_attachment( self, ) -> Attached<Self::Main, <Self::Attachment as Deref>::Target>
Clone the attached metadata.
Sourcefn replace_attachment(
&mut self,
attachment: Self::Attachment,
) -> Self::Attachment
fn replace_attachment( &mut self, attachment: Self::Attachment, ) -> Self::Attachment
Replace the attached metadata.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.