Struct scale_info::Path
source · pub struct Path<T: Form = MetaForm> {
pub segments: Vec<T::String>,
}Expand description
Represents the path of a type definition.
This consists of several segments that each have to be a valid Rust
identifier. The first segment represents the crate name in which the type
has been defined. The last segment is the identifier accessed with ident().
Rust prelude type may have an empty namespace definition.
Fields§
§segments: Vec<T::String>The segments of the namespace.
Implementations§
source§impl Path<MetaForm>
impl Path<MetaForm>
sourcepub fn from_segments<I>(segments: I) -> Result<Self, PathError>where
I: IntoIterator<Item = <MetaForm as Form>::String>,
pub fn from_segments<I>(segments: I) -> Result<Self, PathError>where I: IntoIterator<Item = <MetaForm as Form>::String>,
Create a Path from the given segments
Errors
- If no segments are supplied
- If any of the segments are invalid Rust identifiers
source§impl<T> Path<T>where
T: Form,
impl<T> Path<T>where T: Form,
sourcepub fn from_segments_unchecked<I>(segments: I) -> Path<T>where
I: IntoIterator<Item = T::String>,
pub fn from_segments_unchecked<I>(segments: I) -> Path<T>where I: IntoIterator<Item = T::String>,
Create a Path from the given segments.
Does not check that the segments are valid Rust identifiers.
Trait Implementations§
source§impl<T: Form> Decode for Path<T>where
Vec<T::String>: Decode,
impl<T: Form> Decode for Path<T>where Vec<T::String>: Decode,
source§fn decode<__CodecInputEdqy: Input>(
__codec_input_edqy: &mut __CodecInputEdqy
) -> Result<Self, Error>
fn decode<__CodecInputEdqy: Input>( __codec_input_edqy: &mut __CodecInputEdqy ) -> Result<Self, Error>
Attempt to deserialise the value from input.
source§fn decode_into<I>(
input: &mut I,
dst: &mut MaybeUninit<Self>
) -> Result<DecodeFinished, Error>where
I: Input,
fn decode_into<I>( input: &mut I, dst: &mut MaybeUninit<Self> ) -> Result<DecodeFinished, Error>where I: Input,
Attempt to deserialize the value from input into a pre-allocated piece of memory. Read more
source§impl Display for Path<PortableForm>
impl Display for Path<PortableForm>
source§impl<T: Form> Encode for Path<T>where
Vec<T::String>: Encode,
impl<T: Form> Encode for Path<T>where Vec<T::String>: Encode,
source§fn encode_to<__CodecOutputEdqy: Output + ?Sized>(
&self,
__codec_dest_edqy: &mut __CodecOutputEdqy
)
fn encode_to<__CodecOutputEdqy: Output + ?Sized>( &self, __codec_dest_edqy: &mut __CodecOutputEdqy )
Convert self to a slice and append it to the destination.
source§fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
fn using_encoded<R, F: FnOnce(&[u8]) -> R>(&self, f: F) -> R
Convert self to a slice and then invoke the given closure with it.
source§fn size_hint(&self) -> usize
fn size_hint(&self) -> usize
If possible give a hint of expected size of the encoding. Read more
source§fn encoded_size(&self) -> usize
fn encoded_size(&self) -> usize
Calculates the encoded size. Read more
source§impl IntoPortable for Path
impl IntoPortable for Path
§type Output = Path<PortableForm>
type Output = Path<PortableForm>
The portable version of
Self.source§fn into_portable(self, _registry: &mut Registry) -> Self::Output
fn into_portable(self, _registry: &mut Registry) -> Self::Output
Convert
self to the portable form by using the registry for caching.source§impl<T: Ord + Form> Ord for Path<T>where
T::String: Ord,
impl<T: Ord + Form> Ord for Path<T>where T::String: Ord,
source§impl<T: PartialEq + Form> PartialEq<Path<T>> for Path<T>where
T::String: PartialEq,
impl<T: PartialEq + Form> PartialEq<Path<T>> for Path<T>where T::String: PartialEq,
source§impl<T: PartialOrd + Form> PartialOrd<Path<T>> for Path<T>where
T::String: PartialOrd,
impl<T: PartialOrd + Form> PartialOrd<Path<T>> for Path<T>where T::String: PartialOrd,
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self and other) and is used by the <=
operator. Read moreimpl<T: Form> EncodeLike<Path<T>> for Path<T>where Vec<T::String>: Encode,
impl<T: Eq + Form> Eq for Path<T>where T::String: Eq,
impl<T: Form> StructuralEq for Path<T>
impl<T: Form> StructuralPartialEq for Path<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for Path<T>where <T as Form>::String: RefUnwindSafe,
impl<T> Send for Path<T>where <T as Form>::String: Send,
impl<T> Sync for Path<T>where <T as Form>::String: Sync,
impl<T> Unpin for Path<T>where <T as Form>::String: Unpin,
impl<T> UnwindSafe for Path<T>where <T as Form>::String: 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