pub struct InputContent { /* private fields */ }Expand description
An owned, coherent text-and-token snapshot: what content() returns and
what set_value accepts. Plain text converts into content without tokens,
and every token is validated against the text as it is attached, so a
content value is always consistent.
Implementations§
Source§impl InputContent
impl InputContent
pub fn new(text: impl Into<SharedString>) -> Self
Sourcepub fn with_token(
self,
range: Range<usize>,
token: InlineToken,
) -> Result<Self, InlineTokenError>
pub fn with_token( self, range: Range<usize>, token: InlineToken, ) -> Result<Self, InlineTokenError>
Attach a token to a half-open UTF-8 byte range of the text. The range must be nonempty, sit on grapheme boundaries, contain exactly the token’s text and not overlap another token.
pub fn text(&self) -> &SharedString
pub fn tokens(&self) -> &[InlineTokenSpan]
Trait Implementations§
Source§impl Clone for InputContent
impl Clone for InputContent
Source§impl Debug for InputContent
impl Debug for InputContent
impl Eq for InputContent
Source§fn from(text: &SharedString) -> Self
fn from(text: &SharedString) -> Self
Converts to this type from the input type.
Source§impl From<&String> for InputContent
impl From<&String> for InputContent
Source§impl From<&mut str> for InputContent
impl From<&mut str> for InputContent
Source§impl From<&str> for InputContent
impl From<&str> for InputContent
Source§fn from(text: SharedString) -> Self
fn from(text: SharedString) -> Self
Converts to this type from the input type.
Source§impl From<String> for InputContent
impl From<String> for InputContent
Source§impl From<char> for InputContent
impl From<char> for InputContent
Source§impl PartialEq for InputContent
impl PartialEq for InputContent
impl StructuralPartialEq for InputContent
Auto Trait Implementations§
impl Forget for InputContent
impl Freeze for InputContentwhere
&'static str: Freeze,
*const ArcInner<str> is !null: Freeze,
PhantomData<ArcInner<str>>: Freeze,
*const u8 is !null: Freeze,
PhantomData<InlineTokenSpan>: Freeze,
impl Move for InputContent
impl RefUnwindSafe for InputContent
impl Send for InputContent
impl Sync for InputContent
impl Unpin for InputContent
impl UnsafeUnpin for InputContentwhere
&'static str: UnsafeUnpin,
*const ArcInner<str> is !null: UnsafeUnpin,
PhantomData<ArcInner<str>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<InlineTokenSpan>: UnsafeUnpin,
impl UnwindSafe for InputContent
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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