[−][src]Struct nt::NetworkTables
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]
ip: &'_ str,
client_name: &'_ str
) -> Result<NetworkTables<Client>>
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]
&self,
callback_type: ConnectionCallbackType,
action: impl FnMut(&SocketAddr) + Send + 'static
)
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]
&mut self,
callback_type: ConnectionCallbackType,
action: impl FnMut(&SocketAddr) + Send + 'static
)
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
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]
F: FnMut(&EntryData) + Send + 'static,
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,
<T as NTBackend>::State: Send,
impl<T> Sync for NetworkTables<T> where
<T as NTBackend>::State: Send,
<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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,