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 new_with_replace(
ident: &'static str,
module_path: &'static str,
segment_replace: &[(&'static str, &'static str)],
) -> Path
pub fn new_with_replace( ident: &'static str, module_path: &'static str, segment_replace: &[(&'static str, &'static str)], ) -> Path
Create a new Path
The segment_replace
is a list of (search, replace)
items. Every
search
item that appears in the module_path
is replaced by the
replace
item. This can be used for example to replace the crate name
or even the name of the type in the final Path
.
§Panics
- If the type identifier, module path or replace contain invalid Rust identifiers
sourcepub fn from_segments<I>(segments: I) -> Result<Self, PathError>
pub fn from_segments<I>(segments: I) -> Result<Self, PathError>
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>
impl<T: Form> Decode for Path<T>
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>
impl<T: Form> Encode for Path<T>
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 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<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>(
&self,
f: __CodecUsingEncodedCallback,
) -> __CodecOutputReturn
fn using_encoded<__CodecOutputReturn, __CodecUsingEncodedCallback: FnOnce(&[u8]) -> __CodecOutputReturn>( &self, f: __CodecUsingEncodedCallback, ) -> __CodecOutputReturn
Convert self to a slice and then invoke the given closure with it.
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
source§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>
impl<T: Ord + Form> Ord for Path<T>
source§impl<T: PartialOrd + Form> PartialOrd for Path<T>where
T::String: PartialOrd,
impl<T: PartialOrd + Form> PartialOrd for Path<T>where
T::String: PartialOrd,
impl<T: Form> EncodeLike for Path<T>
impl<T: Eq + Form> Eq for Path<T>
impl<T: Form> StructuralPartialEq for Path<T>
Auto Trait Implementations§
impl<T> Freeze for Path<T>
impl<T> RefUnwindSafe for Path<T>
impl<T> Send for Path<T>
impl<T> Sync for Path<T>
impl<T> Unpin for Path<T>
impl<T> UnwindSafe for Path<T>
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)