pub struct Scope { /* private fields */ }Expand description
The Scope struct is a two-part pathlike structure intendend to be used as a
configurable mechanism to defining the context and working directory of a service.
Implementations§
Source§impl Scope
impl Scope
pub fn new(workdir: impl ToString) -> Self
Sourcepub fn as_path_str(&self) -> String
pub fn as_path_str(&self) -> String
converts the scope into a string
Sourcepub fn set_context<T: ToString>(&mut self, context: T) -> &mut Self
pub fn set_context<T: ToString>(&mut self, context: T) -> &mut Self
update the context of the scope and return a mutable reference to the current instance
Sourcepub fn with_context(self, context: impl ToString) -> Self
pub fn with_context(self, context: impl ToString) -> Self
consumes the current scope to create another with the given context
Sourcepub fn set_workdir<T: ToString>(&mut self, workdir: T) -> &mut Self
pub fn set_workdir<T: ToString>(&mut self, workdir: T) -> &mut Self
update the workdir of the scope and return a mutable reference to the current instance
Sourcepub fn with_workdir(self, workdir: impl ToString) -> Self
pub fn with_workdir(self, workdir: impl ToString) -> Self
consumes the current scope to create another with the given workdir
Sourcepub fn set_some_context<C: ToString>(&mut self, rhs: Option<C>)
pub fn set_some_context<C: ToString>(&mut self, rhs: Option<C>)
only applies the context if it is not empty
Sourcepub fn set_some_workdir(&mut self, rhs: Option<impl ToString>)
pub fn set_some_workdir(&mut self, rhs: Option<impl ToString>)
only applies the workdir if it is not empty
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