pub struct IgtlServer { /* private fields */ }
Expand description
Synchronous OpenIGTLink server
Uses blocking I/O with std::net::TcpListener
for simple, synchronous server implementation.
Implementations§
Source§impl IgtlServer
impl IgtlServer
Sourcepub fn bind(addr: &str) -> Result<Self>
pub fn bind(addr: &str) -> Result<Self>
Bind to a local address and create a server
§Arguments
addr
- Local address to bind (e.g., “127.0.0.1:18944”)
§Errors
IgtlError::Io
- Failed to bind (address in use, insufficient permissions, etc.)
§Examples
use openigtlink_rust::io::IgtlServer;
let server = IgtlServer::bind("127.0.0.1:18944")?;
Sourcepub fn accept(&self) -> Result<IgtlConnection>
pub fn accept(&self) -> Result<IgtlConnection>
Accept a new client connection
Blocks until a client connects.
§Errors
IgtlError::Io
- Failed to accept connection
§Examples
use openigtlink_rust::io::IgtlServer;
let server = IgtlServer::bind("127.0.0.1:18944")?;
let connection = server.accept()?;
Sourcepub fn local_addr(&self) -> Result<SocketAddr>
pub fn local_addr(&self) -> Result<SocketAddr>
Get the local address this server is bound to
Auto Trait Implementations§
impl Freeze for IgtlServer
impl RefUnwindSafe for IgtlServer
impl Send for IgtlServer
impl Sync for IgtlServer
impl Unpin for IgtlServer
impl UnwindSafe for IgtlServer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more