Skip to content

Commit cdd7dd4

Browse files
committed
docs(dvc): clarify silent overwrite behavior
Signed-off-by: uchouT <i@uchout.moe>
1 parent bdd54f9 commit cdd7dd4

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

crates/ironrdp-dvc/src/client.rs

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,13 @@ impl DrdynvcClient {
8989
}
9090
}
9191

92-
/// Registers a pre-initialized dynamic virtual channel with the DrdynvcClient,
92+
/// Registers a pre-initialized dynamic virtual channel with the [`DrdynvcClient`],
9393
/// making it available for immediate use when the session starts.
94+
///
95+
/// # Note
96+
///
97+
/// If a listener or a pre-registered channel with the same name already exists,
98+
/// it will be silently overwritten.
9499
#[must_use]
95100
pub fn with_dynamic_channel<T>(mut self, channel: T) -> Self
96101
where
@@ -100,7 +105,27 @@ impl DrdynvcClient {
100105
self
101106
}
102107

103-
/// Bind a listener. Doesn't support type id look up
108+
/// Attaches a pre-initialized dynamic virtual channel with the [`DrdynvcClient`],
109+
/// making it available for immediate use when the session starts.
110+
///
111+
/// # Note
112+
///
113+
/// If a listener or a pre-registered channel with the same name already exists,
114+
/// it will be silently overwritten.
115+
pub fn attach_dynamic_channel<T>(&mut self, channel: T)
116+
where
117+
T: DvcProcessor + 'static,
118+
{
119+
self.dynamic_channels.register_once(channel);
120+
}
121+
122+
/// Bind a listener.
123+
///
124+
/// # Note
125+
///
126+
/// * Doesn't support [TypeId] lookup via [DrdynvcClient::get_dvc_by_type_id].
127+
/// * If a listener or a pre-registered channel with the same name already exists,
128+
/// it will be silently overwritten.
104129
#[must_use]
105130
pub fn with_listener<T>(mut self, listener: T) -> Self
106131
where
@@ -110,21 +135,20 @@ impl DrdynvcClient {
110135
self
111136
}
112137

113-
/// Doesn't support type id look up
138+
/// Attaches a listener.
139+
///
140+
/// # Note
141+
///
142+
/// * Doesn't support [TypeId] lookup via [DrdynvcClient::get_dvc_by_type_id].
143+
/// * If a listener or a pre-registered channel with the same name already exists,
144+
/// it will be silently overwritten.
114145
pub fn attach_listener<T>(&mut self, listener: T)
115146
where
116147
T: DvcChannelListener + 'static,
117148
{
118149
self.dynamic_channels.register_listener(listener);
119150
}
120151

121-
pub fn attach_dynamic_channel<T>(&mut self, channel: T)
122-
where
123-
T: DvcProcessor + 'static,
124-
{
125-
self.dynamic_channels.register_once(channel);
126-
}
127-
128152
pub fn get_dvc_by_type_id<T>(&self) -> Option<&DynamicVirtualChannel>
129153
where
130154
T: DvcProcessor,

0 commit comments

Comments
 (0)