Skip to main content

ServerAddress

Enum ServerAddress 

Source
pub enum ServerAddress {
Show 20 variants Local, InProcess { thread: u64, }, Coroutine { id: u64, }, Tcp { host: String, port: u16, }, Unix { path: PathBuf, }, Wasm { region: String, }, Http { url: String, }, Ws { url: String, }, Sse { url: String, }, Smtp { address: String, }, Imap { address: String, mailbox: String, }, Telegram { chat_id: String, bot: String, }, Matrix { room_id: String, }, Stdin, FileTail { path: PathBuf, }, Cron { spec: String, }, Webhook { route: String, }, Agent { agent: String, }, Pipeline { steps: Vec<ServerAddress>, }, Any,
}
Expand description

Location of a SIM server endpoint, parsed from an address expression.

Identifies where eval/agent traffic is served – in-process, over a transport, through an integration, or as a pipeline of stages.

Variants§

§

Local

The current process; no transport is involved.

§

InProcess

A peer thread within the same process.

Fields

§thread: u64

Identifier of the target thread.

§

Coroutine

A coroutine within the local scheduler.

Fields

§id: u64

Identifier of the target coroutine.

§

Tcp

A TCP endpoint.

Fields

§host: String

Host name or address to connect to.

§port: u16

TCP port number.

§

Unix

A Unix domain socket.

Fields

§path: PathBuf

Filesystem path of the socket.

§

Wasm

A wasm guest region.

Fields

§region: String

Name of the target wasm region.

§

Http

An HTTP endpoint.

Fields

§url: String

URL to reach the endpoint.

§

Ws

A WebSocket endpoint.

Fields

§url: String

URL to reach the endpoint.

§

Sse

A server-sent events endpoint.

Fields

§url: String

URL to reach the endpoint.

§

Smtp

An SMTP mail endpoint.

Fields

§address: String

Mail address to send to.

§

Imap

An IMAP mailbox endpoint.

Fields

§address: String

Mail address of the account.

§mailbox: String

Mailbox name to read.

§

Telegram

A Telegram bot chat endpoint.

Fields

§chat_id: String

Identifier of the target chat.

§bot: String

Bot account used to send.

§

Matrix

A Matrix room endpoint.

Fields

§room_id: String

Identifier of the target room.

§

Stdin

Standard input as a source.

§

FileTail

A file followed for appended lines.

Fields

§path: PathBuf

Filesystem path of the file to tail.

§

Cron

A cron schedule that triggers serving.

Fields

§spec: String

Cron schedule specification.

§

Webhook

An inbound webhook route.

Fields

§route: String

Route the webhook is mounted at.

§

Agent

A named agent endpoint.

Fields

§agent: String

Identifier or name of the target agent.

§

Pipeline

A sequence of addresses chained as stages.

Fields

§steps: Vec<ServerAddress>

Ordered stages making up the pipeline.

§

Any

A wildcard address matching any endpoint.

Implementations§

Source§

impl ServerAddress

Source

pub fn is_remote_like(&self) -> bool

Returns true when the address denotes a non-local endpoint.

Local and Any are local; a Pipeline is remote-like if any of its stages is.

Source

pub fn from_expr(expr: &Expr) -> Result<Self>

Parses a ServerAddress from an address expression.

A bare symbol selects local, stdin, or any; a list or vector is read as a kind symbol followed by key/value option pairs.

Source

pub fn kind_symbol(&self) -> Symbol

Returns the symbol naming this address kind (e.g. tcp, pipeline).

Source

pub fn as_value(&self, cx: &mut Cx) -> Result<Value>

Builds a runtime table value describing the address.

The table carries a kind entry plus one entry per field of the variant; a Pipeline nests its stages as a list of such tables.

Source

pub fn transport_available(&self) -> bool

Returns true when a transport is implemented for this address kind.

Source

pub fn ensure_transport_available(&self) -> Result<()>

Succeeds when a transport exists for this address, else returns an error.

Trait Implementations§

Source§

impl Clone for ServerAddress

Source§

fn clone(&self) -> ServerAddress

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 ServerAddress

Source§

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

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

impl Eq for ServerAddress

Source§

impl PartialEq for ServerAddress

Source§

fn eq(&self, other: &ServerAddress) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for ServerAddress

Auto Trait Implementations§

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> 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.