pub struct RdpClient<S> { /* private fields */ }
Implementations§
Source§impl<S: Read + Write> RdpClient<S>
impl<S: Read + Write> RdpClient<S>
Sourcepub fn read<T>(&mut self, callback: T) -> RdpResult<()>
pub fn read<T>(&mut self, callback: T) -> RdpResult<()>
Read a payload from the server RDpClient use a callback pattern that can be called more than once during a read call
§Example
use std::net::{SocketAddr, TcpStream};
use rdp::core::client::Connector;
use rdp::core::event::RdpEvent;
let addr = "127.0.0.1:3389".parse::<SocketAddr>().unwrap();
let tcp = TcpStream::connect(&addr).unwrap();
let mut connector = Connector::new()
.screen(800, 600)
.credentials("domain".to_string(), "username".to_string(), "password".to_string());
let mut client = connector.connect(tcp).unwrap();
client.read(|rdp_event| {
match rdp_event {
RdpEvent::Bitmap(bitmap) => {
// do something with bitmap
}
_ => println!("Unhandled event")
}
}).unwrap()
Sourcepub fn write(&mut self, event: RdpEvent) -> RdpResult<()>
pub fn write(&mut self, event: RdpEvent) -> RdpResult<()>
Write an event to the server Typically is all about input event like mouse and keyboard
§Example
use std::net::{SocketAddr, TcpStream};
use rdp::core::client::Connector;
use rdp::core::event::{RdpEvent, PointerEvent, PointerButton};
let addr = "127.0.0.1:3389".parse::<SocketAddr>().unwrap();
let tcp = TcpStream::connect(&addr).unwrap();
let mut connector = Connector::new()
.screen(800, 600)
.credentials("domain".to_string(), "username".to_string(), "password".to_string());
let mut client = connector.connect(tcp).unwrap();
client.write(RdpEvent::Pointer(
// Send a mouse click down at 100x100
PointerEvent {
x: 100 as u16,
y: 100 as u16,
button: PointerButton::Left,
down: true
}
)).unwrap()
Auto Trait Implementations§
impl<S> Freeze for RdpClient<S>where
S: Freeze,
impl<S> !RefUnwindSafe for RdpClient<S>
impl<S> Send for RdpClient<S>where
S: Send,
impl<S> !Sync for RdpClient<S>
impl<S> Unpin for RdpClient<S>where
S: Unpin,
impl<S> !UnwindSafe for RdpClient<S>
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