pub struct StaticPath { /* private fields */ }Expand description
A path both of whose halves the compiler knows: the levels and the joined form, checked against each other where they are written.
StorePath holds a run-time path behind an Arc, which costs two things
a declaration cannot pay. It has a destructor, so a static built from one
cannot use .. to fill in the rest of a struct; and its joined form cannot
be read in a const, which is where the checks over a declaration run.
This type has neither: it is Copy, it owns nothing, and everything about
it is available while the code is compiled.
It is what a declaration carries. Turn it into a StorePath with
StaticPath::path wherever a run-time path is wanted.
Implementations§
Source§impl StaticPath
impl StaticPath
Sourcepub const fn new(
segments: &'static [&'static str],
joined: &'static str,
) -> Self
pub const fn new( segments: &'static [&'static str], joined: &'static str, ) -> Self
§Panics
If any level is empty, or if joined is not the joined form of
segments - at compile time, which is the only place this is meant to
be called. See StorePath::from_static, which checks the same pair.
Sourcepub const fn as_str(&self) -> &'static str
pub const fn as_str(&self) -> &'static str
The whole path as one string, where a const can read it.
pub const fn is_root(&self) -> bool
Trait Implementations§
Source§impl AsRef<str> for StaticPath
impl AsRef<str> for StaticPath
Source§impl Clone for StaticPath
impl Clone for StaticPath
Source§fn clone(&self) -> StaticPath
fn clone(&self) -> StaticPath
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more