pub struct RoundtripContext { /* private fields */ }Expand description
One region of the editor attached to a query.
Implementations§
Source§impl RoundtripContext
impl RoundtripContext
Sourcepub fn document(buffer: EditorBuffer<'_>) -> Option<Self>
pub fn document(buffer: EditorBuffer<'_>) -> Option<Self>
The active document, or None when there is nothing worth attaching.
Sourcepub fn document_with_limit(
buffer: EditorBuffer<'_>,
limit: usize,
) -> Option<Self>
pub fn document_with_limit( buffer: EditorBuffer<'_>, limit: usize, ) -> Option<Self>
The active document, shortened to at most limit characters when the
model window is smaller than the protocol’s hard cap.
Sourcepub fn library(path: &Path, content: &str) -> Option<Self>
pub fn library(path: &Path, content: &str) -> Option<Self>
The author’s bibliography, attached as a whole.
Sourcepub fn library_with_limit(
path: &Path,
content: &str,
limit: usize,
) -> Option<Self>
pub fn library_with_limit( path: &Path, content: &str, limit: usize, ) -> Option<Self>
The bibliography, shortened to at most limit characters.
Sourcepub fn selection(buffer: EditorBuffer<'_>, range: Range<usize>) -> Option<Self>
pub fn selection(buffer: EditorBuffer<'_>, range: Range<usize>) -> Option<Self>
A passage the author marked, or None when the marked text is blank.
range is char-indexed and document-relative, matching
replace_at. The digest covers the full marked text, so an answer
stays checkable even when the model only saw a truncated excerpt.
Sourcepub fn selection_with_limit(
buffer: EditorBuffer<'_>,
range: Range<usize>,
limit: usize,
) -> Option<Self>
pub fn selection_with_limit( buffer: EditorBuffer<'_>, range: Range<usize>, limit: usize, ) -> Option<Self>
A marked passage, shortened to at most limit characters.
Sourcepub fn text(&self) -> &str
pub fn text(&self) -> &str
The raw passage text, without the protocol container.
Enriched retrieval uses this to embed a marked passage together with the question.
Sourcepub fn attachment_label(&self) -> String
pub fn attachment_label(&self) -> String
A pending attachment whose content is this container.
The worker’s ScicoAttach passes pre-built containers through, so
the attributes survive unchanged.
Sourcepub fn note(&self) -> ContextNote
pub fn note(&self) -> ContextNote
The facts the transcript note is built from.
Sourcepub fn shortened(&self, limit: usize) -> Self
pub fn shortened(&self, limit: usize) -> Self
A copy shortened to at most limit characters.
Used when a small model window cannot fit the protocol’s hard cap; the full length and digest stay attached to the shortened container.
Sourcepub fn range(&self) -> Option<Range<usize>>
pub fn range(&self) -> Option<Range<usize>>
The char range of the marked passage, for selections only.
Sourcepub fn kind(&self) -> RoundtripKind
pub fn kind(&self) -> RoundtripKind
Which part of the editor this context came from.
Trait Implementations§
Source§impl Clone for RoundtripContext
impl Clone for RoundtripContext
Source§impl Debug for RoundtripContext
impl Debug for RoundtripContext
impl Eq for RoundtripContext
Source§impl PartialEq for RoundtripContext
impl PartialEq for RoundtripContext
impl StructuralPartialEq for RoundtripContext
Auto Trait Implementations§
impl Freeze for RoundtripContext
impl RefUnwindSafe for RoundtripContext
impl Send for RoundtripContext
impl Sync for RoundtripContext
impl Unpin for RoundtripContext
impl UnsafeUnpin for RoundtripContext
impl UnwindSafe for RoundtripContext
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
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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
key and return true if they are equal.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§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> ⓘ
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> ⓘ
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