pub struct Directive { /* private fields */ }
Expand description
A single scfg directive, containing any number of parameters, and possibly one child block.
Implementations§
source§impl Directive
impl Directive
sourcepub fn take_params(&mut self) -> Vec<String>
pub fn take_params(&mut self) -> Vec<String>
Take this directive’s parameters, leaving it empty.
sourcepub fn append_param(&mut self, param: impl Into<String>) -> &mut Self
pub fn append_param(&mut self, param: impl Into<String>) -> &mut Self
Appends the supplied parameter. Returns &mut self
to support method
chaining.
§Note
This does not validate that param
is a legal scfg word. It is possible to create
unparsable documents should param
contain control characters or newlines.
sourcepub fn clear_params(&mut self)
pub fn clear_params(&mut self)
Clears all parameters from this directive.
sourcepub fn take_child(&mut self) -> Option<Scfg>
pub fn take_child(&mut self) -> Option<Scfg>
Takes this directive’s child, leaving it with None
.
sourcepub fn get_or_create_child(&mut self) -> &mut Scfg
pub fn get_or_create_child(&mut self) -> &mut Scfg
Returns the child, optionally creating it if it does not exist.
let mut directive = Directive::new();
assert!(directive.child().is_none());
directive.get_or_create_child();
assert!(directive.child().is_some());
Trait Implementations§
impl Eq for Directive
impl StructuralPartialEq for Directive
Auto Trait Implementations§
impl Freeze for Directive
impl RefUnwindSafe for Directive
impl Send for Directive
impl Sync for Directive
impl Unpin for Directive
impl UnwindSafe for Directive
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
)