pub enum Fragment<'a> {
Owned(OwnedFragment),
Borrowed(BorrowedFragment<'a>),
None,
}Expand description
Core enum for fragment types
Variants§
Implementations§
Source§impl Fragment<'_>
impl Fragment<'_>
pub fn owned_internal(text: impl Into<String>) -> Fragment<'_>
pub fn owned_empty() -> Fragment<'_>
pub fn borrowed_internal(text: &str) -> Fragment<'_>
pub fn none() -> Fragment<'_>
pub fn testing_empty() -> Fragment<'static>
Source§impl<'a> Fragment<'a>
impl<'a> Fragment<'a>
Sourcepub fn line(&self) -> StatementLine
pub fn line(&self) -> StatementLine
Get line position
Sourcepub fn column(&self) -> StatementColumn
pub fn column(&self) -> StatementColumn
Get column position
Sourcepub fn into_owned(self) -> OwnedFragment
pub fn into_owned(self) -> OwnedFragment
Convert to owned variant
Sourcepub fn to_static(self) -> Fragment<'static>
pub fn to_static(self) -> Fragment<'static>
Convert to owned Fragment with ’static lifetime while preserving location info
Sourcepub fn as_borrowed(&'a self) -> Fragment<'a>
pub fn as_borrowed(&'a self) -> Fragment<'a>
Create a borrowed view of this fragment
Sourcepub fn sub_fragment(&self, offset: usize, length: usize) -> OwnedFragment
pub fn sub_fragment(&self, offset: usize, length: usize) -> OwnedFragment
Get a sub-fragment starting at the given offset with the given length
Sourcepub fn merge_all(
fragments: impl IntoIterator<Item = Fragment<'a>>,
) -> Fragment<'a>
pub fn merge_all( fragments: impl IntoIterator<Item = Fragment<'a>>, ) -> Fragment<'a>
Merge multiple fragments (in any order) into one encompassing fragment
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Fragment<'a>
impl<'de, 'a> Deserialize<'de> for Fragment<'a>
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Fragment<'a>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Fragment<'a>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> IntoFragment<'a> for &'a Fragment<'a>
impl<'a> IntoFragment<'a> for &'a Fragment<'a>
fn into_fragment(self) -> Fragment<'a>
Source§impl<'a> IntoFragment<'a> for Fragment<'a>
impl<'a> IntoFragment<'a> for Fragment<'a>
fn into_fragment(self) -> Fragment<'a>
Source§impl<'a, 'b> LazyFragment<'a> for &'b Fragment<'a>where
'a: 'b,
impl<'a, 'b> LazyFragment<'a> for &'b Fragment<'a>where
'a: 'b,
Source§impl<'a> LazyFragment<'a> for Fragment<'a>
impl<'a> LazyFragment<'a> for Fragment<'a>
Source§impl<'a> Serialize for Fragment<'a>
impl<'a> Serialize for Fragment<'a>
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<'a> Eq for Fragment<'a>
Auto Trait Implementations§
impl<'a> Freeze for Fragment<'a>
impl<'a> RefUnwindSafe for Fragment<'a>
impl<'a> Send for Fragment<'a>
impl<'a> Sync for Fragment<'a>
impl<'a> Unpin for Fragment<'a>
impl<'a> UnwindSafe for Fragment<'a>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)