pub struct SourceSpan {
pub start: u64,
pub end: u64,
pub file_id: u16,
}Expand description
Source-location metadata for a posting that the host parsed from a beancount file.
Plugins receive this on every parser-derived posting and must
preserve it unchanged when modifying an existing posting (the default
for a typical “edit one field” plugin). When a plugin synthesizes a
brand-new posting, leave PostingData::span as None and the host
will mark it SYNTHESIZED_FILE_ID.
Byte offsets are stored as u64 so the wire format is stable
across 32-bit (WASM) and 64-bit (host) targets, and so very large
concatenated source trees (includes-of-includes) cannot silently
overflow. The contents are otherwise opaque to plugin code: do
not synthesize spans by guessing offsets.
Fields§
§start: u64Start byte offset within the file (inclusive).
end: u64End byte offset within the file (exclusive).
file_id: u16Source file index in the host’s source map.
Trait Implementations§
Source§impl Clone for SourceSpan
impl Clone for SourceSpan
Source§fn clone(&self) -> SourceSpan
fn clone(&self) -> SourceSpan
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for SourceSpan
Source§impl Debug for SourceSpan
impl Debug for SourceSpan
Source§impl<'de> Deserialize<'de> for SourceSpan
impl<'de> Deserialize<'de> for SourceSpan
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>,
impl Eq for SourceSpan
Source§impl PartialEq for SourceSpan
impl PartialEq for SourceSpan
Source§fn eq(&self, other: &SourceSpan) -> bool
fn eq(&self, other: &SourceSpan) -> bool
self and other values to be equal, and is used by ==.