pub struct SyntaxFile { /* private fields */ }Expand description
A syntax file and its contents.
This holds the entire contents of a syntax file, which are always read into memory in their entirety, recoded into UTF-8 if necessary. It includes the file name (if any), and an index to make finding lines by line number more efficient.
Implementations§
Source§impl SyntaxFile
impl SyntaxFile
Sourcepub fn for_file<P>(
path: P,
encoding: Option<&'static Encoding>,
) -> IoResult<Self>
pub fn for_file<P>( path: P, encoding: Option<&'static Encoding>, ) -> IoResult<Self>
Returns a SyntaxFile by reading path and recoding it from
encoding.
Sourcepub fn new(
contents: String,
file_name: Option<String>,
encoding: &'static Encoding,
) -> Self
pub fn new( contents: String, file_name: Option<String>, encoding: &'static Encoding, ) -> Self
Creates a new SyntaxFile for contents, recording that contents was
originally encoded in encoding and that it was read from file_name.
Sourcepub fn for_string(contents: String) -> Self
pub fn for_string(contents: String) -> Self
Returns a SyntaxFile for contents.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SyntaxFile
impl RefUnwindSafe for SyntaxFile
impl Send for SyntaxFile
impl Sync for SyntaxFile
impl Unpin for SyntaxFile
impl UnsafeUnpin for SyntaxFile
impl UnwindSafe for SyntaxFile
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more