pub struct SublimeScopeMapper { /* private fields */ }Expand description
A simple scope-to-StyleId mapper for .sublime-syntax scopes.
Consumers are expected to keep a mapper instance around so StyleIds stay
stable across re-highlighting passes.
Implementations§
Source§impl SublimeScopeMapper
impl SublimeScopeMapper
Sourcepub const BASE: StyleId = 0x0300_0000
pub const BASE: StyleId = 0x0300_0000
Base prefix for Sublime scope StyleIds.
Values below this are reserved for other style sources (e.g. semantic tokens, simple regex highlighting).
Sourcepub fn style_id_for_scope(&mut self, scope: &str) -> StyleId
pub fn style_id_for_scope(&mut self, scope: &str) -> StyleId
Get (or allocate) a stable StyleId for a Sublime scope string.
Sourcepub fn scope_for_style_id(&self, style_id: StyleId) -> Option<&str>
pub fn scope_for_style_id(&self, style_id: StyleId) -> Option<&str>
Return the original scope string for a previously allocated StyleId.
Trait Implementations§
Source§impl Debug for SublimeScopeMapper
impl Debug for SublimeScopeMapper
Source§impl Default for SublimeScopeMapper
impl Default for SublimeScopeMapper
Source§fn default() -> SublimeScopeMapper
fn default() -> SublimeScopeMapper
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SublimeScopeMapper
impl RefUnwindSafe for SublimeScopeMapper
impl Send for SublimeScopeMapper
impl Sync for SublimeScopeMapper
impl Unpin for SublimeScopeMapper
impl UnsafeUnpin for SublimeScopeMapper
impl UnwindSafe for SublimeScopeMapper
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