pub struct ScopedMetadata<'a> {
pub items: Vec<(MatchPower, &'a MetadataSet)>,
}Expand description
A collection of MetadataSets which match a given scope selector, sorted by the strength of
the match
§Examples
// given the following two scoped metadata collections:
let one_selector = "source.my_lang";
let one_items = json!({
"increaseIndentPattern": "one increase",
"decreaseIndentPattern": "one decrease",
});
let two_selector = "other.thing";
let two_items = json!({
"increaseIndentPattern": "two increase",
});
// both of which match this scope stack:
let query_scope = ScopeStack::from_str("source.my_lang other.thing").unwrap();
let scoped = metadata.metadata_for_scope(query_scope.as_slice());
// the better match is used when it has a field,
assert!(scoped.increase_indent("two increase"));
// and the other match is used when it does not.
assert!(scoped.decrease_indent("one decrease"));Fields§
§items: Vec<(MatchPower, &'a MetadataSet)>Implementations§
Source§impl<'a> ScopedMetadata<'a>
impl<'a> ScopedMetadata<'a>
pub fn unindented_line(&self, line: &str) -> bool
pub fn decrease_indent(&self, line: &str) -> bool
pub fn increase_indent(&self, line: &str) -> bool
pub fn bracket_increase(&self, line: &str) -> bool
pub fn disable_indent_next_line(&self, line: &str) -> bool
pub fn line_comment(&self) -> Option<&str>
pub fn block_comment(&self) -> Option<(&str, &str)>
pub fn is_empty(&self) -> bool
Trait Implementations§
Source§impl<'a> Clone for ScopedMetadata<'a>
impl<'a> Clone for ScopedMetadata<'a>
Auto Trait Implementations§
impl<'a> Freeze for ScopedMetadata<'a>
impl<'a> RefUnwindSafe for ScopedMetadata<'a>
impl<'a> Send for ScopedMetadata<'a>
impl<'a> Sync for ScopedMetadata<'a>
impl<'a> Unpin for ScopedMetadata<'a>
impl<'a> UnsafeUnpin for ScopedMetadata<'a>
impl<'a> UnwindSafe for ScopedMetadata<'a>
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