Struct syntect::parsing::syntax_definition::SyntaxDefinition
source · [−]pub struct SyntaxDefinition {
pub name: String,
pub file_extensions: Vec<String>,
pub scope: Scope,
pub first_line_match: Option<String>,
pub hidden: bool,
pub variables: HashMap<String, String>,
pub contexts: HashMap<String, Context>,
}
Expand description
The main data structure representing a syntax definition loaded from a
.sublime-syntax
file
You’ll probably only need these as references to be passed around to parsing code.
Some useful public fields are the name
field which is a human readable name to display in
syntax lists, and the hidden
field which means hide this syntax from any lists because it is
for internal use.
Fields
name: String
file_extensions: Vec<String>
scope: Scope
first_line_match: Option<String>
variables: HashMap<String, String>
contexts: HashMap<String, Context>
Implementations
sourceimpl SyntaxDefinition
impl SyntaxDefinition
sourcepub fn load_from_str(
s: &str,
lines_include_newline: bool,
fallback_name: Option<&str>
) -> Result<SyntaxDefinition, ParseSyntaxError>
pub fn load_from_str(
s: &str,
lines_include_newline: bool,
fallback_name: Option<&str>
) -> Result<SyntaxDefinition, ParseSyntaxError>
In case you want to create your own SyntaxDefinition’s in memory from strings.
Generally you should use a SyntaxSet
.
fallback_name
is an optional name to use when the YAML doesn’t provide a name
key.
Trait Implementations
sourceimpl Clone for SyntaxDefinition
impl Clone for SyntaxDefinition
sourcefn clone(&self) -> SyntaxDefinition
fn clone(&self) -> SyntaxDefinition
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for SyntaxDefinition
impl Debug for SyntaxDefinition
sourceimpl<'de> Deserialize<'de> for SyntaxDefinition
impl<'de> Deserialize<'de> for SyntaxDefinition
sourcefn 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
sourceimpl PartialEq<SyntaxDefinition> for SyntaxDefinition
impl PartialEq<SyntaxDefinition> for SyntaxDefinition
sourcefn eq(&self, other: &SyntaxDefinition) -> bool
fn eq(&self, other: &SyntaxDefinition) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SyntaxDefinition) -> bool
fn ne(&self, other: &SyntaxDefinition) -> bool
This method tests for !=
.
sourceimpl Serialize for SyntaxDefinition
impl Serialize for SyntaxDefinition
impl Eq for SyntaxDefinition
impl StructuralEq for SyntaxDefinition
impl StructuralPartialEq for SyntaxDefinition
Auto Trait Implementations
impl RefUnwindSafe for SyntaxDefinition
impl Send for SyntaxDefinition
impl Sync for SyntaxDefinition
impl Unpin for SyntaxDefinition
impl UnwindSafe for SyntaxDefinition
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more