[][src]Trait skyway_webrtc_gateway_api::prelude::SerializableSocket

pub trait SerializableSocket<T> {
    fn new(id: Option<String>, socket: SocketAddr) -> Self;
fn try_create(
        id: Option<String>,
        ip: &str,
        port: u16
    ) -> Result<Self, Error>
    where
        Self: Sized
;
fn get_id(&self) -> Option<T>;
fn key(&self) -> &'static str;
fn ip(&self) -> IpAddr;
fn port(&self) -> u16; }

This trait is for serializing SocketInfo to JSON.

It also has some getter functions.

Required methods

fn new(id: Option<String>, socket: SocketAddr) -> Self

Create an instance of SerializableSocket

fn try_create(id: Option<String>, ip: &str, port: u16) -> Result<Self, Error> where
    Self: Sized

Create an instance of SerializableSocket.

Failures

It returns error, if the ip and port is not valid for SocketAddr.

fn get_id(&self) -> Option<T>

Returns id field.

fn key(&self) -> &'static str

Field name of Json.

fn ip(&self) -> IpAddr

Returns IpAddr of the socket.

fn port(&self) -> u16

Returns port number of the socket.

Loading content...

Implementors

impl<T: SerializableId> SerializableSocket<T> for SocketInfo<T>[src]

Loading content...