Skip to main content

Node

Enum Node 

Source
pub enum Node {
    Greeting {
        exits: Option<Exits>,
        prompt: Prompt,
    },
    Hours {
        exceptions: Vec<HoursException>,
        exits: Option<Exits>,
        schedule: WeeklySchedule,
        timezone: String,
    },
    Menu {
        exits: Option<Exits>,
        options: HashMap<String, String>,
        prompt: Prompt,
        retries: u64,
        timeout_secs: u64,
    },
    Ring {
        exits: Option<Exits>,
        timeout_secs: u64,
    },
    Message {
        exits: Option<Exits>,
        max_secs: u64,
        prompt: Prompt,
        tone: MessageTone,
    },
    Transfer {
        exits: Option<Exits>,
        target: String,
    },
    Hangup {
        exits: Option<Exits>,
        prompt: Option<Prompt>,
    },
}
Expand description

One node: a component (kind + its config) plus its wired exits. An internally-tagged union on kind.

JSON schema
{
 "description": "One node: a component (kind + its config) plus its wired exits. An internally-tagged union on `kind`.",
 "oneOf": [
   {
     "description": "Speak a prompt, then continue. Exit: next.",
     "type": "object",
     "required": [
       "kind",
       "prompt"
     ],
     "properties": {
       "exits": {
         "$ref": "#/definitions/Exits"
       },
       "kind": {
         "enum": [
           "greeting"
         ]
       },
       "prompt": {
         "$ref": "#/definitions/Prompt"
       }
     }
   },
   {
     "description": "Branch on the business's weekly schedule + holiday overrides. Exits: open, closed.",
     "type": "object",
     "required": [
       "kind",
       "schedule",
       "timezone"
     ],
     "properties": {
       "exceptions": {
         "type": "array",
         "items": {
           "$ref": "#/definitions/HoursException"
         }
       },
       "exits": {
         "$ref": "#/definitions/Exits"
       },
       "kind": {
         "enum": [
           "hours"
         ]
       },
       "schedule": {
         "$ref": "#/definitions/WeeklySchedule"
       },
       "timezone": {
         "description": "IANA zone (America/New_York). Validated to resolve at load.",
         "type": "string"
       }
     }
   },
   {
     "description": "Speak a prompt and collect a DTMF choice. Exits: one per digit in options, plus no_input and invalid.",
     "type": "object",
     "required": [
       "kind",
       "options",
       "prompt"
     ],
     "properties": {
       "exits": {
         "$ref": "#/definitions/Exits"
       },
       "kind": {
         "enum": [
           "menu"
         ]
       },
       "options": {
         "description": "Digit key → human label. The exit for a digit is exits[digit]. Valid digit keys are enforced by the validator.",
         "type": "object",
         "additionalProperties": {
           "type": "string"
         }
       },
       "prompt": {
         "$ref": "#/definitions/Prompt"
       },
       "retries": {
         "default": 1,
         "type": "integer",
         "minimum": 0.0
       },
       "timeout_secs": {
         "default": 5,
         "type": "integer",
         "minimum": 0.0
       }
     }
   },
   {
     "description": "Ring the human for a window. answered is an implicit terminal; the only wired exit is no_answer.",
     "type": "object",
     "required": [
       "kind",
       "timeout_secs"
     ],
     "properties": {
       "exits": {
         "$ref": "#/definitions/Exits"
       },
       "kind": {
         "enum": [
           "ring"
         ]
       },
       "timeout_secs": {
         "type": "integer",
         "minimum": 0.0
       }
     }
   },
   {
     "description": "Voicemail: speak a prompt, record, transcribe, notify. Terminal.",
     "type": "object",
     "required": [
       "kind",
       "prompt"
     ],
     "properties": {
       "exits": {
         "$ref": "#/definitions/Exits"
       },
       "kind": {
         "enum": [
           "message"
         ]
       },
       "max_secs": {
         "default": 120,
         "type": "integer",
         "minimum": 0.0
       },
       "prompt": {
         "$ref": "#/definitions/Prompt"
       },
       "tone": {
         "default": "beep",
         "allOf": [
           {
             "$ref": "#/definitions/MessageTone"
           }
         ]
       }
     }
   },
   {
     "description": "Blind-transfer to an external number. Terminal.",
     "type": "object",
     "required": [
       "kind",
       "target"
     ],
     "properties": {
       "exits": {
         "$ref": "#/definitions/Exits"
       },
       "kind": {
         "enum": [
           "transfer"
         ]
       },
       "target": {
         "type": "string"
       }
     }
   },
   {
     "description": "Speak an optional goodbye and end the call. Terminal.",
     "type": "object",
     "required": [
       "kind"
     ],
     "properties": {
       "exits": {
         "$ref": "#/definitions/Exits"
       },
       "kind": {
         "enum": [
           "hangup"
         ]
       },
       "prompt": {
         "$ref": "#/definitions/Prompt"
       }
     }
   }
 ]
}

Variants§

§

Greeting

Speak a prompt, then continue. Exit: next.

Fields

§exits: Option<Exits>
§prompt: Prompt
§

Hours

Branch on the business’s weekly schedule + holiday overrides. Exits: open, closed.

Fields

§exceptions: Vec<HoursException>
§exits: Option<Exits>
§timezone: String

IANA zone (America/New_York). Validated to resolve at load.

§

Menu

Speak a prompt and collect a DTMF choice. Exits: one per digit in options, plus no_input and invalid.

Fields

§exits: Option<Exits>
§options: HashMap<String, String>

Digit key → human label. The exit for a digit is exits[digit]. Valid digit keys are enforced by the validator.

§prompt: Prompt
§retries: u64
§timeout_secs: u64
§

Ring

Ring the human for a window. answered is an implicit terminal; the only wired exit is no_answer.

Fields

§exits: Option<Exits>
§timeout_secs: u64
§

Message

Voicemail: speak a prompt, record, transcribe, notify. Terminal.

Fields

§exits: Option<Exits>
§max_secs: u64
§prompt: Prompt
§

Transfer

Blind-transfer to an external number. Terminal.

Fields

§exits: Option<Exits>
§target: String
§

Hangup

Speak an optional goodbye and end the call. Terminal.

Fields

§exits: Option<Exits>
§prompt: Option<Prompt>

Implementations§

Source§

impl Node

Source

pub fn kind(&self) -> &'static str

The kind tag, for traces and diagnostics.

Source

pub fn is_terminal(&self) -> bool

Whether a caller who reaches this node can have the call end here. ring counts — its implicit answered hands the call to a human, which ends the flow. Used by the “no caller is ever trapped” check.

Source

pub fn required_exits(&self) -> Vec<String>

The exit names this node must wire, given its config. Validation checks the node’s exits keys are exactly this set — no missing exit (a dead choice) and no stray exit (a typo the engine would never follow).

Source

pub fn exits(&self) -> Option<&HashMap<String, String>>

The node’s wired exits (exit name → target node id), or None when the document omits the block. Every generated variant carries an exits: Option<Exits>, so this reads them uniformly.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Node

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Node

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<&Node> for Node

Source§

fn from(value: &Node) -> Self

Converts to this type from the input type.
Source§

impl Serialize for Node

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.