#[non_exhaustive]pub struct Header {
pub date: Option<String>,
pub version: Option<String>,
pub timescale: Option<(u32, TimescaleUnit)>,
pub items: Vec<ScopeItem>,
}
Expand description
Structure containing the data from the header of a VCD file.
A Header
can be parsed from VCD with Parser::parse_header
, or create an
empty Header
with Header::default
.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.date: Option<String>
$date
text
version: Option<String>
$version
text
timescale: Option<(u32, TimescaleUnit)>
Parsed $timescale
indicating the time unit used in the file
items: Vec<ScopeItem>
Top-level variables, scopes, and comments
Implementations§
source§impl Header
impl Header
sourcepub fn find_scope<S>(&self, path: &[S]) -> Option<&Scope>where
S: Borrow<str>,
pub fn find_scope<S>(&self, path: &[S]) -> Option<&Scope>where S: Borrow<str>,
Find the scope object at a specified path.
Example
let mut parser = vcd::Parser::new(&b"
$scope module a $end
$scope module b $end
$var integer 16 n0 counter $end
$upscope $end
$upscope $end
$enddefinitions $end
"[..]);
let header = parser.parse_header().unwrap();
let scope = header.find_scope(&["a", "b"]).unwrap();
assert_eq!(scope.identifier, "b");
sourcepub fn find_var<S>(&self, path: &[S]) -> Option<&Var>where
S: Borrow<str>,
pub fn find_var<S>(&self, path: &[S]) -> Option<&Var>where S: Borrow<str>,
Find the variable object at a specified path.
Example
let mut parser = vcd::Parser::new(&b"
$scope module a $end
$scope module b $end
$var integer 16 n0 counter $end
$upscope $end
$upscope $end
$enddefinitions $end
"[..]);
let header = parser.parse_header().unwrap();
let var = header.find_var(&["a", "b", "counter"]).unwrap();
assert_eq!(var.reference, "counter");
Trait Implementations§
Auto Trait Implementations§
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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