pub struct SourceId(/* private fields */);Expand description
A SourceId represents the index/identifier associated with a unique source file in a SourceManager implementation.
Implementations§
Source§impl SourceId
impl SourceId
pub const UNKNOWN: Self
Sourcepub fn file(id: u32) -> Self
pub fn file(id: u32) -> Self
Create a new SourceId representing a file, from a u32 value, but assert if out of range
Sourcepub fn argument(id: u32) -> Self
pub fn argument(id: u32) -> Self
Create a new SourceId representing a command-line argument, from a u32 value, but assert
if out of range
Sourcepub const fn new_unchecked(id: u32) -> Self
pub const fn new_unchecked(id: u32) -> Self
Create a new SourceId from a raw u32 value
pub const fn to_index(self) -> usize
pub const fn group(&self) -> SourceGroup
pub const fn to_u32(self) -> u32
pub const fn is_unknown(&self) -> bool
pub const fn is_cli_argument(&self) -> bool
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SourceId
impl<'de> Deserialize<'de> for SourceId
Source§fn 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
Source§impl Ord for SourceId
impl Ord for SourceId
Source§impl PartialOrd for SourceId
impl PartialOrd for SourceId
impl Copy for SourceId
impl Eq for SourceId
impl StructuralPartialEq for SourceId
Auto Trait Implementations§
impl Freeze for SourceId
impl RefUnwindSafe for SourceId
impl Send for SourceId
impl Sync for SourceId
impl Unpin for SourceId
impl UnsafeUnpin for SourceId
impl UnwindSafe for SourceId
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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