pub struct VirtualView {
pub source: String,
pub atoms: Vec<String>,
pub ghost_atoms: Vec<String>,
pub token_estimate: usize,
pub language: String,
pub symbol_locations: HashMap<String, usize>,
pub fragments: Vec<ViewFragment>,
pub truncated: bool,
pub explanation: String,
}Expand description
A virtual view - atoms assembled into a coherent context
Fields§
§source: StringThe assembled source code
atoms: Vec<String>Atoms included in this view (in order)
ghost_atoms: Vec<String>Which atoms were added automatically (Ghost Imports)
token_estimate: usizeTotal token estimate
language: StringPrimary language of the view
symbol_locations: HashMap<String, usize>Map of symbol name -> line number in the view
fragments: Vec<ViewFragment>Fragments that make up this view
truncated: boolWas the view truncated due to token limits?
explanation: StringExplanation of how the view was constructed
Implementations§
Source§impl VirtualView
impl VirtualView
Sourcepub fn line_count(&self) -> usize
pub fn line_count(&self) -> usize
Get the number of lines in the view
Sourcepub fn defined_symbols(&self) -> Vec<&String>
pub fn defined_symbols(&self) -> Vec<&String>
Get the symbols defined in this view
Sourcepub fn find_symbol(&self, name: &str) -> Option<usize>
pub fn find_symbol(&self, name: &str) -> Option<usize>
Find the line number where a symbol is defined
Sourcepub fn snippet_for_symbol(
&self,
name: &str,
context_lines: usize,
) -> Option<String>
pub fn snippet_for_symbol( &self, name: &str, context_lines: usize, ) -> Option<String>
Get a snippet around a symbol
Sourcepub fn contains_atom(&self, chunk_id: &str) -> bool
pub fn contains_atom(&self, chunk_id: &str) -> bool
Check if this view contains a specific atom
Trait Implementations§
Source§impl Clone for VirtualView
impl Clone for VirtualView
Source§fn clone(&self) -> VirtualView
fn clone(&self) -> VirtualView
Returns a duplicate 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 VirtualView
impl Debug for VirtualView
Source§impl<'de> Deserialize<'de> for VirtualView
impl<'de> Deserialize<'de> for VirtualView
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
Auto Trait Implementations§
impl Freeze for VirtualView
impl RefUnwindSafe for VirtualView
impl Send for VirtualView
impl Sync for VirtualView
impl Unpin for VirtualView
impl UnwindSafe for VirtualView
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