pub struct Quote {
pub exact: String,
pub prefix: String,
pub suffix: String,
}Expand description
The text a range covers, and what stands either side of it.
Fields§
§exact: String§prefix: StringUp to 32 characters before exact, ending where it starts.
suffix: StringUp to 32 characters after exact, starting where it ends.
Implementations§
Source§impl Quote
impl Quote
Sourcepub fn of(doc: &Doc, range: Selection) -> Option<Self>
pub fn of(doc: &Doc, range: Selection) -> Option<Self>
The quote under range, or None for a collapsed range.
Text parts are read in document order with a newline between each, so a
range across blocks quotes the break as \n.
Sourcepub fn find(&self, doc: &Doc, hint: Option<Selection>) -> Option<Selection>
pub fn find(&self, doc: &Doc, hint: Option<Selection>) -> Option<Selection>
Where the quote is in doc, or None when its text is gone.
hint is the range as last saved. Where it still covers the exact
text, it is the answer. Otherwise every occurrence is weighed by how
much of the prefix and suffix still stand beside it, and a tie goes to
the one nearest the hint.
Trait Implementations§
impl Eq for Quote
impl StructuralPartialEq for Quote
Auto Trait Implementations§
impl Freeze for Quote
impl RefUnwindSafe for Quote
impl Send for Quote
impl Sync for Quote
impl Unpin for Quote
impl UnsafeUnpin for Quote
impl UnwindSafe for Quote
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.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