pub struct ViewFragment {
pub chunk_id: String,
pub alias: Option<String>,
pub start_line: usize,
pub end_line: usize,
pub token_count: usize,
pub inclusion_reason: InclusionReason,
pub defines: Vec<String>,
}Expand description
A fragment in a virtual view
Fields§
§chunk_id: StringThe chunk ID this fragment came from
alias: Option<String>Alias if available
start_line: usizeStart line in the assembled view
end_line: usizeEnd line in the assembled view
token_count: usizeToken count for this fragment
inclusion_reason: InclusionReasonWhy this fragment was included
defines: Vec<String>Symbols defined in this fragment
Implementations§
Source§impl ViewFragment
impl ViewFragment
Sourcepub fn new(chunk_id: impl Into<String>, reason: InclusionReason) -> Self
pub fn new(chunk_id: impl Into<String>, reason: InclusionReason) -> Self
Create a new fragment
Sourcepub fn with_alias(self, alias: impl Into<String>) -> Self
pub fn with_alias(self, alias: impl Into<String>) -> Self
With alias
Sourcepub fn with_lines(self, start: usize, end: usize) -> Self
pub fn with_lines(self, start: usize, end: usize) -> Self
With line range
Sourcepub fn with_tokens(self, tokens: usize) -> Self
pub fn with_tokens(self, tokens: usize) -> Self
With token count
Trait Implementations§
Source§impl Clone for ViewFragment
impl Clone for ViewFragment
Source§fn clone(&self) -> ViewFragment
fn clone(&self) -> ViewFragment
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 ViewFragment
impl Debug for ViewFragment
Source§impl<'de> Deserialize<'de> for ViewFragment
impl<'de> Deserialize<'de> for ViewFragment
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 ViewFragment
impl RefUnwindSafe for ViewFragment
impl Send for ViewFragment
impl Sync for ViewFragment
impl Unpin for ViewFragment
impl UnwindSafe for ViewFragment
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