ironrdp_server

Trait RdpServerDisplay

Source
pub trait RdpServerDisplay: Send {
    // Required methods
    fn size<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = DesktopSize> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn updates<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Box<dyn RdpServerDisplayUpdates>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn request_layout(&mut self, layout: DisplayControlMonitorLayout) { ... }
}
Expand description

Display for an RDP server

§Example

use ironrdp_server::{DesktopSize, DisplayUpdate, RdpServerDisplay, RdpServerDisplayUpdates};

pub struct DisplayUpdates {
    receiver: tokio::sync::mpsc::Receiver<DisplayUpdate>,
}

#[async_trait::async_trait]
impl RdpServerDisplayUpdates for DisplayUpdates {
    async fn next_update(&mut self) -> Option<DisplayUpdate> {
        self.receiver.recv().await
    }
}

pub struct DisplayHandler {
    width: u16,
    height: u16,
}

#[async_trait::async_trait]
impl RdpServerDisplay for DisplayHandler {
    async fn size(&mut self) -> DesktopSize {
        DesktopSize { width: self.width, height: self.height }
    }

    async fn updates(&mut self) -> Result<Box<dyn RdpServerDisplayUpdates>> {
        Ok(Box::new(DisplayUpdates { receiver: todo!() }))
    }
}

Required Methods§

Source

fn size<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = DesktopSize> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

This method should return the current size of the display. Currently, there is no way for the client to negotiate resolution, so the size returned by this method will be enforced.

Source

fn updates<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn RdpServerDisplayUpdates>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return a display updates receiver

Provided Methods§

Source

fn request_layout(&mut self, layout: DisplayControlMonitorLayout)

Request a new size for the display

Implementors§