pub struct Scope { /* private fields */ }Expand description
Scope stores critical information regarding the applications current position within the filesystem. The context is considered to be the current working directory of the application while the workdir is used to point to the directory where all of the assets are stored.
Implementations§
Source§impl Scope
impl Scope
pub fn from_workdir<T>(workdir: T) -> Selfwhere
T: ToString,
Sourcepub fn context_mut(&mut self) -> Option<&mut String>
pub fn context_mut(&mut self) -> Option<&mut String>
returns a mutable reference to the context of the scope
Sourcepub fn as_path(&self) -> PathBuf
pub fn as_path(&self) -> PathBuf
convert the scope into a PathBuf, automatically including the context if it exists
Sourcepub fn as_path_str(&self) -> String
pub fn as_path_str(&self) -> String
converts the scope into a string
Sourcepub fn contextless(self) -> Self
pub fn contextless(self) -> Self
consumes the current instance to ensure no context is present
Sourcepub fn set_context<T>(&mut self, context: T)where
T: ToString,
pub fn set_context<T>(&mut self, context: T)where
T: ToString,
sets the context of the scope
Sourcepub fn set_workdir<T>(&mut self, workdir: T)where
T: ToString,
pub fn set_workdir<T>(&mut self, workdir: T)where
T: ToString,
update the current workind directory
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Scope
impl<'de> Deserialize<'de> for Scope
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Scope
impl Ord for Scope
Source§impl PartialOrd for Scope
impl PartialOrd for Scope
impl Eq for Scope
impl StructuralPartialEq for Scope
Auto Trait Implementations§
impl Freeze for Scope
impl RefUnwindSafe for Scope
impl Send for Scope
impl Sync for Scope
impl Unpin for Scope
impl UnwindSafe for Scope
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