pub struct Section { /* private fields */ }
Expand description
One section of an EditorConfig file.
Implementations§
Source§impl Section
impl Section
Sourcepub fn new(pattern: &str) -> Section
pub fn new(pattern: &str) -> Section
Constrcts a new Section
that applies to files matching the specified pattern.
Sourcepub fn props(&self) -> &Properties
pub fn props(&self) -> &Properties
Returns a shared reference to the internal Properties
map.
Sourcepub fn props_mut(&mut self) -> &mut Properties
pub fn props_mut(&mut self) -> &mut Properties
Returns a mutable reference to the internal Properties
map.
Sourcepub fn into_props(self) -> Properties
pub fn into_props(self) -> Properties
Extracts the Properties
map from self
.
Sourcepub fn insert(&mut self, key: impl AsRef<str>, val: impl Into<RawValue>)
pub fn insert(&mut self, key: impl AsRef<str>, val: impl Into<RawValue>)
Adds a property with the specified key, lowercasing the key.
Sourcepub fn applies_to(&self, path: impl AsRef<Path>) -> bool
pub fn applies_to(&self, path: impl AsRef<Path>) -> bool
Returns true if and only if this section applies to a file at the specified path.
Trait Implementations§
Source§impl PropertiesSource for &Section
impl PropertiesSource for &Section
Source§fn apply_to(
self,
props: &mut Properties,
path: impl AsRef<Path>,
) -> Result<(), Error>
fn apply_to( self, props: &mut Properties, path: impl AsRef<Path>, ) -> Result<(), Error>
Adds this section’s properties to a Properties
.
This implementation is infallible.
Auto Trait Implementations§
impl Freeze for Section
impl RefUnwindSafe for Section
impl Send for Section
impl Sync for Section
impl Unpin for Section
impl UnwindSafe for Section
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