Skip to main content

Control

Enum Control 

Source
pub enum Control {
    Init {
        version: u32,
        host: String,
        superuser: Option<Value>,
    },
    Open {
        channel: String,
        payload: String,
        options: Map<String, Value>,
    },
    Done {
        channel: String,
    },
    Close {
        channel: String,
        problem: Option<String>,
    },
}
Expand description

Control messages we SEND (empty-channel JSON, tagged by command).

Variants§

§

Init

Initial handshake message.

Fields

§version: u32

Protocol version.

§host: String

Host label.

§superuser: Option<Value>

Superuser negotiation mode at init time. fez sends "none" to defer escalation: the bridge brings up no root peer at init, and fez later selects a working mechanism itself via cockpit.Superuser.Start (sudo, falling through to polkit). Omitted entirely when None.

§

Open

Open a new channel.

Fields

§channel: String

Channel id to allocate.

§payload: String

Channel payload type (e.g. dbus-json3, stream).

§options: Map<String, Value>

Additional open options (bus, name, spawn, …).

§

Done

Signal end of input on a channel.

Fields

§channel: String

Channel being finished.

§

Close

Close a channel, optionally reporting a problem.

Fields

§channel: String

Channel to close.

§problem: Option<String>

Problem kind if the close is abnormal.

Implementations§

Source§

impl Control

Source

pub fn open(channel: &str, payload: &str) -> Control

Build an Open control for channel with the given payload type.

Source

pub fn opt(self, key: &str, value: Value) -> Control

Builder helper for Open options (bus, name, spawn, …).

Source

pub fn to_json(&self) -> Vec<u8>

Serialize this control message to JSON bytes.

Returns a safe-close frame on serialization failure so the bridge sees a well-formed command rather than receiving nothing.

Trait Implementations§

Source§

impl Debug for Control

Source§

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

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

impl Serialize for Control

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§

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