pub struct Schema { /* private fields */ }Expand description
The complete stratum.toml schema.
There is one schema per library version; obtain it with schema. It
serialises as {"schema_version": 1, "fields": [...]} for the HTTP schema
endpoint, and every other part of this crate (validation, the seed
document, the public view) is derived from the same table.
§Examples
use stratum_node_config::schema;
for field in schema().fields() {
println!("{} ({}): {}", field.path(), field.apply_class(), field.description());
}
assert!(schema().field("listen.address").is_some());Implementations§
Source§impl Schema
impl Schema
Sourcepub fn seed_text(&self) -> String
pub fn seed_text(&self) -> String
Returns the canonical seed stratum.toml: every field at its default,
grouped by table in schema order, each preceded by its description
and apply class as comments.
The seed always parses, validates, and has exactly the default effective configuration.
§Examples
use stratum_node_config::{schema, ConfigDocument};
let seed = schema().seed_text();
assert!(seed.contains("\n[listen]\n"));
let doc = ConfigDocument::parse(&seed)?;
assert_eq!(doc.config().node_name(), "stratum");Trait Implementations§
Auto Trait Implementations§
impl Forget for Schema
impl Freeze for Schemawhere
&'static [FieldDescriptor]: Freeze,
impl Move for Schema
impl RefUnwindSafe for Schema
impl Send for Schemawhere
&'static [FieldDescriptor]: Send,
impl Sync for Schema
impl Unpin for Schemawhere
&'static [FieldDescriptor]: Unpin,
impl UnsafeUnpin for Schemawhere
&'static [FieldDescriptor]: UnsafeUnpin,
impl UnwindSafe for Schemawhere
&'static [FieldDescriptor]: UnwindSafe,
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