pub struct Json5Options {
pub infinity: bool,
pub hex: bool,
pub hash_comment: bool,
pub backtick_string: bool,
pub number_separator: bool,
pub octal: bool,
pub binary: bool,
pub require_value: bool,
pub strict_value: bool,
}Expand description
The plugin options: a strict JSON5 configuration by default, with the
relaxations jsonic offers beyond the specification opt-in. The
TypeScript Json5Options and the Go Defaults() map.
On the engine the options travel as a Value bag under the plugin
name, spelt with the TypeScript keys (hashComment, requireValue,
…); Json5Options::to_value and Json5Options::from_value
convert, and a key the bag does not carry keeps its default, as the
Go optBool does.
Fields§
§infinity: boolAccept Infinity, NaN and their signed forms as numbers.
hex: boolAccept 0x hexadecimal integers.
hash_comment: boolAccept # line comments (not JSON5).
backtick_string: boolAccept backtick-quoted strings (not JSON5).
number_separator: boolAccept _ digit separators in numbers (not JSON5).
octal: boolAccept 0o octal integers (not JSON5).
binary: boolAccept 0b binary integers (not JSON5).
require_value: boolRequire a top-level value: an empty, whitespace-only or
comments-only source is an error (json5_empty,
json5_no_value) rather than a null result.
strict_value: boolReject unquoted text at a value position, so foo is an error
rather than the string "foo".
Implementations§
Source§impl Json5Options
impl Json5Options
Sourcepub const KEYS: [&str; 9]
pub const KEYS: [&str; 9]
The option keys as the TypeScript plugin and the Go Defaults()
map spell them: the keys Json5Options::to_value writes and
Json5Options::from_value reads.
Sourcepub fn to_value(&self) -> Value
pub fn to_value(&self) -> Value
The options as the engine’s plugin-option bag, keyed as the TypeScript plugin spells them.
Sourcepub fn from_value(bag: &Value) -> Self
pub fn from_value(bag: &Value) -> Self
Read a plugin-option bag. A key that is absent, or not a boolean,
keeps its default, as the Go port’s optBool does.
Trait Implementations§
Source§impl Clone for Json5Options
impl Clone for Json5Options
impl Copy for Json5Options
Source§impl Debug for Json5Options
impl Debug for Json5Options
Source§impl Default for Json5Options
impl Default for Json5Options
impl Eq for Json5Options
Source§impl PartialEq for Json5Options
impl PartialEq for Json5Options
impl StructuralPartialEq for Json5Options
Auto Trait Implementations§
impl Freeze for Json5Options
impl RefUnwindSafe for Json5Options
impl Send for Json5Options
impl Sync for Json5Options
impl Unpin for Json5Options
impl UnsafeUnpin for Json5Options
impl UnwindSafe for Json5Options
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.