pub enum ConfigNode {
Directive(Box<Directive>),
Comment(String),
BlankLine,
}Expand description
A single element in a chrony configuration file.
Each line in a config file is either a directive, a comment, or a blank line.
§Examples
Comments preceding a directive are attached as leading comments to that directive
and do not produce a separate ConfigNode::Comment. Standalone comments (separated
by blank lines) produce ConfigNode::Comment nodes.
use chrony_confile::{ChronyConfig, ConfigNode};
let config: ChronyConfig = "server ntp.example.com\n\n".parse()?;
assert!(matches!(config.nodes[0], ConfigNode::Directive(_)));
assert!(matches!(config.nodes[1], ConfigNode::BlankLine));Variants§
Directive(Box<Directive>)
A parsed directive with its metadata.
Comment(String)
A comment line (excluding the leading # or ;).
BlankLine
An empty or whitespace-only line.
Trait Implementations§
Source§impl Clone for ConfigNode
impl Clone for ConfigNode
Source§fn clone(&self) -> ConfigNode
fn clone(&self) -> ConfigNode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ConfigNode
impl Debug for ConfigNode
Source§impl Display for ConfigNode
impl Display for ConfigNode
Source§impl From<Directive> for ConfigNode
impl From<Directive> for ConfigNode
Source§impl From<DirectiveKind> for ConfigNode
impl From<DirectiveKind> for ConfigNode
Source§fn from(kind: DirectiveKind) -> Self
fn from(kind: DirectiveKind) -> Self
Converts to this type from the input type.
Source§impl PartialEq for ConfigNode
impl PartialEq for ConfigNode
Source§fn eq(&self, other: &ConfigNode) -> bool
fn eq(&self, other: &ConfigNode) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ConfigNode
Auto Trait Implementations§
impl Freeze for ConfigNode
impl RefUnwindSafe for ConfigNode
impl Send for ConfigNode
impl Sync for ConfigNode
impl Unpin for ConfigNode
impl UnsafeUnpin for ConfigNode
impl UnwindSafe for ConfigNode
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