AttachedUtils

Trait AttachedUtils 

Source
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§

Source

type Main

Main data.

Source

type Attachment

Attached metadata.

Required Methods§

Source

fn main(&self) -> &Self::Main

Get an immutable reference to the main data.

Source

fn main_mut(&mut self) -> &mut Self::Main

Get a mutable reference to the main data.

Source

fn attachment(&self) -> &Self::Attachment

Get an immutable reference to the attached metadata.

Source

fn attachment_mut(&mut self) -> &mut Self::Attachment

Get a mutable reference to the attached data.

Source

fn into_tuple(self) -> (Self::Main, Self::Attachment)

Separate the main data from the attached metadata.

Source

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§

Source

fn into_main(self) -> Self::Main

Discard the attached metadata.

Source

fn copy_attachment(&self) -> Self::Attachment
where Self::Attachment: Copy,

Get a copy of the attached metadata.

Source

fn clone_attachment(&self) -> Self::Attachment
where Self::Attachment: Clone,

Get a clone of the attached metadata.

Source

fn map<F, Y>(self, f: F) -> Attached<Y, Self::Attachment>
where F: FnOnce(Self::Main) -> Y,

Map the main data.

Source

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.

Source

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.

Source

fn as_deref(&self) -> Attached<&Self::Main, &Self::Attachment>

Convert an immutable reference of a whole pair to an owned pair of immutable references.

Source

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.

Source

fn copied(self) -> Attached<<Self::Main as Deref>::Target, Self::Attachment>
where Self::Main: Deref<Target: Copy>,

Copy the bits of the main data.

Source

fn cloned(self) -> Attached<<Self::Main as Deref>::Target, Self::Attachment>
where Self::Main: Deref<Target: Clone>,

Clone the main data.

Source

fn copied_attachment( self, ) -> Attached<Self::Main, <Self::Attachment as Deref>::Target>
where Self::Attachment: Deref<Target: Copy>,

Copy the bits of the attached metadata.

Source

fn cloned_attachment( self, ) -> Attached<Self::Main, <Self::Attachment as Deref>::Target>
where Self::Attachment: Deref<Target: Clone>,

Clone the attached metadata.

Source

fn replace(&mut self, main: Self::Main) -> Self::Main

Replace the main data.

Source

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.

Implementors§

Source§

impl<Main, Attachment> AttachedUtils for Attached<Main, Attachment>

Source§

type Main = Main

Source§

type Attachment = Attachment