[][src]Struct nt::NetworkTables

pub struct NetworkTables<T: NTBackend> { /* fields omitted */ }

Core struct representing a connection to a NetworkTables server

Methods

impl NetworkTables<Client>[src]

pub async fn connect<'_, '_>(
    ip: &'_ str,
    client_name: &'_ str
) -> Result<NetworkTables<Client>>
[src]

Connects over TCP to the given ip, with the given client_name

This call will block the thread until the client has completed the handshake with the server, at which point the connection will be valid to send and receive data over

pub async fn reconnect<'_>(&'_ mut self)[src]

Attempts to reconnect to the NetworkTables server if the connection had been terminated.

This function should only be called if you are certain that the previous connection is dead. Connection status can be determined using callbacks specified with add_connection_callback.

pub fn add_connection_callback(
    &self,
    callback_type: ConnectionCallbackType,
    action: impl FnMut(&SocketAddr) + Send + 'static
)
[src]

pub fn call_rpc(
    &self,
    id: u16,
    parameter: Vec<u8>,
    callback: impl Fn(Vec<u8>) + Send + 'static
)
[src]

impl NetworkTables<Server>[src]

pub fn bind(ip: &str, server_name: &str) -> NetworkTables<Server>[src]

Initializes an NT server over TCP and binds it to the given ip, with the given server name.

pub fn add_connection_callback(
    &mut self,
    callback_type: ConnectionCallbackType,
    action: impl FnMut(&SocketAddr) + Send + 'static
)
[src]

Adds a callback for connection state updates regarding clients.

Depending on the chosen callback type, the callback will be called when a new client connects, or when an existing client disconnects from the server

pub fn create_rpc(
    &mut self,
    data: EntryData,
    callback: impl Fn(Vec<u8>) -> Vec<u8> + Send + Sync + RefUnwindSafe + 'static
)
[src]

impl<T: NTBackend> NetworkTables<T>[src]

pub fn entries(&self) -> HashMap<u16, EntryData>[src]

Returns a copy of the entries recognizes by the connection

pub fn get_entry(&self, id: u16) -> Entry<T>[src]

Gets the entry with the given id, returning an Entry for the specified data

pub async fn create_entry<'_>(&'_ self, data: EntryData) -> Result<u16>[src]

Creates a new entry with the specified data, returning the id assigned to it by the server This call may block if this connection is acting as a client, while it waits for the id to be assigned by the remote server

pub fn delete_entry(&self, id: u16)[src]

Deletes the entry with the given id

pub fn clear_entries(&self)[src]

Clears all the entries associated with this connection

pub fn update_entry(&self, id: u16, new_value: EntryValue)[src]

Updates the entry of the given id, with the new value

pub fn add_callback<F>(&mut self, action: CallbackType, cb: F) where
    F: FnMut(&EntryData) + Send + 'static, 
[src]

Adds an entry callback of the given type.

Depending on what is chosen, the callback will be notified when a new entry is created, an existing entry is updated, or an existing entry is deleted.

pub fn update_entry_flags(&self, id: u16, new_flags: u8)[src]

Updates the flags associated with the entry of the given id

Trait Implementations

impl<T: NTBackend> Drop for NetworkTables<T>[src]

Auto Trait Implementations

impl<T> !RefUnwindSafe for NetworkTables<T>

impl<T> Send for NetworkTables<T> where
    <T as NTBackend>::State: Send

impl<T> Sync for NetworkTables<T> where
    <T as NTBackend>::State: Send

impl<T> Unpin for NetworkTables<T>

impl<T> !UnwindSafe for NetworkTables<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.