Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/ironrdp-mstsgu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ ironrdp-core = { path = "../ironrdp-core", version = "0.1", features = ["std"] }
ironrdp-error = { path = "../ironrdp-error", version = "0.1" }
ironrdp-tls = { path = "../ironrdp-tls", version = "0.2" }
log = "0.4"
thiserror = "2"
tokio-tungstenite = { version = "0.29" }
tokio-util = { version = "0.7" }
tokio = { version = "1.52", features = ["macros", "rt"] }
Expand Down
28 changes: 8 additions & 20 deletions crates/ironrdp-mstsgu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ mod macros;

mod proto;

use core::fmt;
use core::fmt::Display;
use core::pin::Pin;
use core::task::Poll;
use core::time::Duration;
Expand Down Expand Up @@ -46,15 +44,22 @@ pub struct GwConnectTarget {

type Error = ironrdp_error::Error<GwErrorKind>;

#[derive(Debug)]
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum GwErrorKind {
#[error("invalid GW Target")]
InvalidGwTarget,
#[error("connection error")]
Connect,
#[error("PacketEOF")]
PacketEof,
#[error("unsupported feature")]
UnsupportedFeature,
#[error("custom")]
Custom,
#[error("encode")]
Encode,
#[error("decode")]
Decode,
}

Expand All @@ -73,23 +78,6 @@ impl GwErrorExt for ironrdp_error::Error<GwErrorKind> {
}
}

impl Display for GwErrorKind {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
let x = match self {
GwErrorKind::InvalidGwTarget => "invalid GW Target",
GwErrorKind::Connect => "connection error",
GwErrorKind::PacketEof => "PacketEOF",
GwErrorKind::UnsupportedFeature => "unsupported feature",
GwErrorKind::Custom => "custom",
GwErrorKind::Encode => "encode",
GwErrorKind::Decode => "decode",
};
f.write_str(x)
}
}

impl core::error::Error for GwErrorKind {}

struct GwConn {
client_name: String,
target: GwConnectTarget,
Expand Down
Loading