Struct cedar_policy_core::parser::SourceInfo
source · pub struct SourceInfo(pub Range<usize>);
Expand description
Describes where in policy source code a node in the CST or expression AST occurs.
Tuple Fields§
§0: Range<usize>
Implementations§
source§impl SourceInfo
impl SourceInfo
sourcepub const fn new(start: usize, len: usize) -> Self
pub const fn new(start: usize, len: usize) -> Self
Construct a new SourceInfo
from a start offset and a length, in
bytes.
sourcepub const fn from_offset(offset: usize) -> Self
pub const fn from_offset(offset: usize) -> Self
Construct a new zero-length SourceInfo
pointing to a specific
offset.
sourcepub const fn range_start(&self) -> usize
pub const fn range_start(&self) -> usize
Get the start of range, in bytes.
sourcepub const fn len(&self) -> usize
pub const fn len(&self) -> usize
Get the length of the source range, in bytes.
§Panics
Panics if the end of the range is before the start.
sourcepub const fn is_empty(&self) -> bool
pub const fn is_empty(&self) -> bool
Tests whether this SourceInfo
range is a zero-length offset.
Trait Implementations§
source§impl Clone for SourceInfo
impl Clone for SourceInfo
source§fn clone(&self) -> SourceInfo
fn clone(&self) -> SourceInfo
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SourceInfo
impl Debug for SourceInfo
source§impl<'de> Deserialize<'de> for SourceInfo
impl<'de> Deserialize<'de> for SourceInfo
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 Display for SourceInfo
impl Display for SourceInfo
source§impl From<SourceInfo> for Range<usize>
impl From<SourceInfo> for Range<usize>
source§fn from(info: SourceInfo) -> Self
fn from(info: SourceInfo) -> Self
Converts to this type from the input type.
source§impl From<usize> for SourceInfo
impl From<usize> for SourceInfo
source§impl Hash for SourceInfo
impl Hash for SourceInfo
source§impl Ord for SourceInfo
impl Ord for SourceInfo
source§impl PartialEq for SourceInfo
impl PartialEq for SourceInfo
source§impl PartialOrd for SourceInfo
impl PartialOrd for SourceInfo
source§impl Serialize for SourceInfo
impl Serialize for SourceInfo
impl Eq for SourceInfo
impl StructuralPartialEq for SourceInfo
Auto Trait Implementations§
impl Freeze for SourceInfo
impl RefUnwindSafe for SourceInfo
impl Send for SourceInfo
impl Sync for SourceInfo
impl Unpin for SourceInfo
impl UnwindSafe for SourceInfo
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)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