Enum Node
pub enum Node {
String {
literal: String,
props: NodeProps,
},
Gen {
data: GenOptions,
props: NodeProps,
},
Lexeme {
rx: RegexSpec,
contextual: Option<bool>,
temperature: Option<f32>,
json_string: Option<bool>,
json_allowed_escapes: Option<String>,
json_raw: Option<bool>,
props: NodeProps,
},
GenGrammar {
data: GenGrammarOptions,
props: NodeProps,
},
SpecialToken {
token: String,
props: NodeProps,
},
Select {
among: Vec<NodeId>,
props: NodeProps,
},
Join {
sequence: Vec<NodeId>,
props: NodeProps,
},
}
Variants§
String
Force generation of the specific string.
Gen
Generate according to regex.
Lexeme
Lexeme in a greedy grammar.
Fields
contextual: Option<bool>
If false, all other lexemes are excluded when this lexeme is recognized.
This is normal behavior for keywords in programming languages.
Set to true for eg. a JSON schema with both /"type"/
and /"[^"]*"/
as lexemes,
or for “get”/“set” contextual keywords in C#.
Default value set in GrammarWithLexer.
json_string: Option<bool>
When set, the lexeme will be quoted as a JSON string. For example, /[a-z“]+/ will be quoted as /([a-z]|\“)+/
json_allowed_escapes: Option<String>
It lists the allowed escape sequences, typically one of: “nrbtf\"u” - to allow all JSON escapes, including \u00XX for control characters this is the default “nrbtf\"” - to disallow \u00XX control characters “nrt\"” - to also disallow unusual escapes (\f and \b) “” - to disallow all escapes Note that \uXXXX for non-control characters (code points above U+001F) are never allowed, as they never have to be quoted in JSON.
GenGrammar
Generate according to specified grammar.
SpecialToken
Used for special tokens.
Select
Generate one of the options.
Join
Generate all of the nodes in sequence.
Implementations§
§impl Node
impl Node
pub fn node_props(&self) -> &NodeProps
Trait Implementations§
§impl<'de> Deserialize<'de> for Node
impl<'de> Deserialize<'de> for Node
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Node, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Node, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for Node
impl Serialize for Node
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnwindSafe for Node
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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Any
.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more