Struct ddp_rs::controller::Controller
source · pub struct Controller { /* private fields */ }Expand description
Controller can be though of as the “server”
It listens for incoming connections and dispatchs messages to the correct Connection
Implementations§
source§impl Controller
impl Controller
sourcepub fn new() -> Result<Controller, DDPError>
pub fn new() -> Result<Controller, DDPError>
Create a new DDP controller instance
Listens to the world on UDP port 4048.
If that’s not desired, use Controller::new_with_socket instead.
sourcepub fn new_with_socket(socket: UdpSocket) -> Result<Controller, DDPError>
pub fn new_with_socket(socket: UdpSocket) -> Result<Controller, DDPError>
Basically new() but you get to define your own socket if you want to use another port.
This is useful for binding localhost or other port or tbh whatever tf you want.
sourcepub fn connect<A>(
&mut self,
addr: A,
pixel_config: PixelConfig,
id: ID
) -> Result<(Connection, Receiver<Packet>), DDPError>where
A: ToSocketAddrs,
pub fn connect<A>( &mut self, addr: A, pixel_config: PixelConfig, id: ID ) -> Result<(Connection, Receiver<Packet>), DDPError>where A: ToSocketAddrs,
Connect to a DDP display
Returns a connection which you can write to and a reciever which parses and returns packets.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Controller
impl Send for Controller
impl Sync for Controller
impl Unpin for Controller
impl !UnwindSafe for Controller
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