Skip to main content

KpTrait

Trait KpTrait 

Source
pub trait KpTrait<R, V, Root, Value, MutRoot, MutValue>: Readable<Root, Value> + Writable<MutRoot, MutValue> {
    // Required method
    fn then<SV, SubValue, MutSubValue, Next>(
        self,
        next: Next,
    ) -> impl KeyPath<Root, SubValue, MutRoot, MutSubValue>
       where Self: Sized,
             SubValue: Borrow<SV>,
             MutSubValue: BorrowMut<SV>,
             Next: Readable<Value, SubValue> + Writable<MutValue, MutSubValue> + Clone;

    // Provided methods
    fn type_id_of_root() -> TypeId
       where R: 'static { ... }
    fn type_id_of_value() -> TypeId
       where V: 'static { ... }
}
Expand description

Logical root/value type identity and composition for a keypath.

Required Methods§

Source

fn then<SV, SubValue, MutSubValue, Next>( self, next: Next, ) -> impl KeyPath<Root, SubValue, MutRoot, MutSubValue>
where Self: Sized, SubValue: Borrow<SV>, MutSubValue: BorrowMut<SV>, Next: Readable<Value, SubValue> + Writable<MutValue, MutSubValue> + Clone,

Chain with a keypath over this segment’s value (Value / MutValue are the link types).

Next must read/write from the current value. The returned type is opaque at the trait level; concrete crates (for example rust-key-paths Kp) choose their own struct.

Provided Methods§

Source

fn type_id_of_root() -> TypeId
where R: 'static,

TypeId of the logical root type R.

Source

fn type_id_of_value() -> TypeId
where V: 'static,

TypeId of the logical value type V.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§