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