Interfaces
Concrete async interface constructors, feature flags and manager lifecycle boundaries.
filament-interfaces::Interface defines async send, recv and set_enabled operations plus identity, name, mode, bitrate, MTU and status methods. Bring this trait into scope to call trait methods on a concrete interface. name takes &self; it is not a static TCPClientInterface::name() function.
Available implementations
| Interface | Construction | Notes |
|---|---|---|
AutoInterface | builder().…build().await or new(config).await | IPv6 multicast discovery configuration. Builder type is under the auto module. |
TCPClientInterface | new(target_addr, mode).await or from_config(config).await | Background connection/reconnection; successful construction alone is not a connected peer. Use wait_for_connection(timeout).await to wait for connectivity. |
TCPServerInterface | new(bind_addr, mode).await or from_config(config).await | Server configuration and connected-client accounting. |
UDPInterface | new(port, mode).await or from_config(config).await | Binds IPv4 unspecified address and the configured port. Forwarding destination and broadcast are configurable. |
SerialInterface | See serial declarations | Compiled with the serial feature, which is enabled by the current manifest's defaults. |
The source exports these five concrete interface families. Mentions of other media in older comments do not establish additional implementations.
Configure without opening sockets
These are the actual config field names. This example constructs settings only. It does not connect to the local TCP address or bind the UDP port. Source declarations were checked; this documentation pass did not compile or execute the example.
use std::time::Duration;
use filament_interfaces::{InterfaceMode, TCPClientConfig, UDPInterfaceConfig};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let tcp = TCPClientConfig {
target_addr: "127.0.0.1:4242".parse()?,
mode: InterfaceMode::Full,
connect_timeout: Duration::from_secs(5),
max_reconnect_attempts: Some(3),
..TCPClientConfig::default()
};
let udp = UDPInterfaceConfig {
port: 0,
forward_ip: None,
broadcast: false,
..UDPInterfaceConfig::default()
};
assert_eq!(tcp.target_addr.port(), 4242);
assert_eq!(udp.port, 0);
Ok(())
}TCP config has target_addr, reconnect_interval, max_reconnect_attempts, connect_timeout, mode and optional ifac. UDP config has port, forward_ip, forward_port, mode, broadcast and optional ifac; it does not expose a bind_addr field.
Manager contract
InterfaceManager::new() creates an empty manager. add_interface(Box<dyn Interface>).await requires mutable access and returns an InterfaceId. interface_count().await, list_interfaces().await, send_to(...).await, broadcast(...).await and recv().await expose its registry and queues. There are no register or len methods.
The current receive task holds the interface mutex while awaiting a packet. Calls needing that interface can wait for the receive lock. remove_interface removes its registry entry but does not retain/abort the spawned receive task. Treat these as lifecycle constraints requiring implementation work and multi-process testing before relying on a concurrent, long-running manager. Manager reference.
IFAC layers
The interface IFAC signs/verifies a packet prefix using configured key material and signature size. filament_packet::Ifac is a separate packet-format object. The interface prefix operation does not complete the packet crate's unfinished IFAC-size decoding. IFAC declarations.