pub struct ValueSource {
pub value: Option<Text>,
pub source: Text,
pub location: Option<ValueLocation>,
}Expand description
A config value with associated metadata like where it comes from.
Fields§
§value: Option<Text>§source: Text§location: Option<ValueLocation>Implementations§
Source§impl ValueSource
impl ValueSource
Sourcepub fn value(&self) -> &Option<Text>
pub fn value(&self) -> &Option<Text>
Return the actual value stored in this config value, or None if unset.
Sourcepub fn source(&self) -> &Text
pub fn source(&self) -> &Text
Return the “source” information for the config value. It’s usually who sets the config, like “–config”, “user_hgrc”, “system_hgrc”, etc.
Sourcepub fn location(&self) -> Option<(PathBuf, Range<usize>)>
pub fn location(&self) -> Option<(PathBuf, Range<usize>)>
Return the file path and byte range for the exact config value,
or None if there is no such information.
If the value is None, the byte range is for the “%unset” statement.
Sourcepub fn file_content(&self) -> Option<Text>
pub fn file_content(&self) -> Option<Text>
Return the file content. Or None if there is no such information.
Sourcepub fn line_number(&self) -> Option<usize>
pub fn line_number(&self) -> Option<usize>
Return the line number, starting from 1.
Trait Implementations§
Source§impl Clone for ValueSource
impl Clone for ValueSource
Source§fn clone(&self) -> ValueSource
fn clone(&self) -> ValueSource
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ValueSource
impl !RefUnwindSafe for ValueSource
impl Send for ValueSource
impl Sync for ValueSource
impl Unpin for ValueSource
impl !UnwindSafe for ValueSource
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