Skip to content

Commit e51ed23

Browse files
authored
fix(ironrdp-error): make fields of Error private (#1074)
Refs: 81e2465
1 parent 58c3df8 commit e51ed23

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

crates/ironrdp-connector/src/lib.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,7 @@ pub trait ConnectorResultExt {
406406
impl<T> ConnectorResultExt for ConnectorResult<T> {
407407
fn with_context(self, context: &'static str) -> Self {
408408
self.map_err(|mut e| {
409-
e.context = context;
410-
// e.set_context(context);
409+
e.set_context(context);
411410
e
412411
})
413412
}

crates/ironrdp-error/src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#![cfg_attr(doc, doc = include_str!("../README.md"))]
22
#![doc(html_logo_url = "https://cdnweb.devolutions.net/images/projects/devolutions/logos/devolutions-icon-shadow.svg")]
33
#![cfg_attr(not(feature = "std"), no_std)]
4-
#![expect(clippy::partial_pub_fields)]
54

65
#[cfg(feature = "alloc")]
76
extern crate alloc;
@@ -24,8 +23,8 @@ impl<T> Source for T where T: fmt::Display + fmt::Debug + Send + Sync + 'static
2423

2524
#[derive(Debug)]
2625
pub struct Error<Kind> {
27-
pub context: &'static str,
28-
pub kind: Kind,
26+
context: &'static str,
27+
kind: Kind,
2928
#[cfg(feature = "std")]
3029
source: Option<Box<dyn core::error::Error + Sync + Send>>,
3130
#[cfg(all(not(feature = "std"), feature = "alloc"))]
@@ -81,6 +80,10 @@ impl<Kind> Error<Kind> {
8180
&self.kind
8281
}
8382

83+
pub fn set_context(&mut self, context: &'static str) {
84+
self.context = context;
85+
}
86+
8487
pub fn report(&self) -> ErrorReport<'_, Kind> {
8588
ErrorReport(self)
8689
}

crates/ironrdp-session/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ pub trait SessionResultExt {
110110
impl<T> SessionResultExt for SessionResult<T> {
111111
fn with_context(self, context: &'static str) -> Self {
112112
self.map_err(|mut e| {
113-
e.context = context;
113+
e.set_context(context);
114114
e
115115
})
116116
}

0 commit comments

Comments
 (0)