@@ -23,13 +23,14 @@ use std::marker::PhantomData;
23
23
pub type StaticChannelId = u16 ;
24
24
25
25
/// SVC data to be sent to the server. See [`SvcMessage`] for more information.
26
+ ///
26
27
/// Usually returned by the channel-specific methods.
27
- pub struct SvcMessagesWithProcessor < P : StaticVirtualChannelProcessor > {
28
+ pub struct SvcMessagesForProcessor < P : StaticVirtualChannelProcessor > {
28
29
messages : Vec < SvcMessage > ,
29
30
_channel : PhantomData < P > ,
30
31
}
31
32
32
- impl < P : StaticVirtualChannelProcessor > SvcMessagesWithProcessor < P > {
33
+ impl < P : StaticVirtualChannelProcessor > SvcMessagesForProcessor < P > {
33
34
pub fn new ( messages : Vec < SvcMessage > ) -> Self {
34
35
Self {
35
36
messages,
@@ -38,20 +39,21 @@ impl<P: StaticVirtualChannelProcessor> SvcMessagesWithProcessor<P> {
38
39
}
39
40
}
40
41
41
- impl < P : StaticVirtualChannelProcessor > From < Vec < SvcMessage > > for SvcMessagesWithProcessor < P > {
42
+ impl < P : StaticVirtualChannelProcessor > From < Vec < SvcMessage > > for SvcMessagesForProcessor < P > {
42
43
fn from ( messages : Vec < SvcMessage > ) -> Self {
43
44
Self :: new ( messages)
44
45
}
45
46
}
46
47
47
- impl < P : StaticVirtualChannelProcessor > From < SvcMessagesWithProcessor < P > > for Vec < SvcMessage > {
48
- fn from ( request : SvcMessagesWithProcessor < P > ) -> Self {
48
+ impl < P : StaticVirtualChannelProcessor > From < SvcMessagesForProcessor < P > > for Vec < SvcMessage > {
49
+ fn from ( request : SvcMessagesForProcessor < P > ) -> Self {
49
50
request. messages
50
51
}
51
52
}
52
53
53
54
/// Encodable PDU to be sent over a static virtual channel.
54
- /// Additional SVC header flags could be added via [`SvcMessage::with_flags`] method.
55
+ ///
56
+ /// Additional SVC header flags can be added via [`SvcMessage::with_flags`] method.
55
57
pub struct SvcMessage {
56
58
pdu : Box < dyn PduEncode > ,
57
59
flags : ChannelFlags ,
@@ -146,7 +148,7 @@ impl StaticVirtualChannel {
146
148
/// There are at most 31 (optional) static virtual channels that can be created for a single connection, for a
147
149
/// total of 32 static channels when accounting for the non-optional I/O channel.
148
150
pub trait StaticVirtualChannelProcessor : AsAny + fmt:: Debug + Send + Sync {
149
- /// Returns the name of the `StaticVirtualChannelProcessor`
151
+ /// Returns the name of the static virtual channel corresponding to this processor.
150
152
fn channel_name ( & self ) -> ChannelName ;
151
153
152
154
/// Defines which compression flag should be sent along the [`ChannelDef`] Definition Structure (`CHANNEL_DEF`)
@@ -336,8 +338,8 @@ macro_rules! impl_as_any {
336
338
} ;
337
339
}
338
340
339
- /// A set holding at most one [`StaticVirtualChannel`] for any given static channel and
340
- /// its corresponding [`ChunkProcessor `].
341
+ /// A set holding at most one [`StaticVirtualChannel`] for any given type
342
+ /// implementing [`StaticVirtualChannelProcessor `].
341
343
///
342
344
/// To ensure uniqueness, each trait object is associated to the [`TypeId`] of it’s original type.
343
345
/// Once joined, channels may have their ID attached using [`Self::attach_channel_id()`], effectively
@@ -373,22 +375,22 @@ impl StaticChannelSet {
373
375
self . channels . insert ( TypeId :: of :: < T > ( ) , StaticVirtualChannel :: new ( val) )
374
376
}
375
377
376
- /// Gets a reference to a [`StaticVirtualChannel`] by looking up its [`TypeId`].
378
+ /// Gets a reference to a [`StaticVirtualChannel`] by looking up its internal [`StaticVirtualChannelProcessor`]'s [`TypeId`].
377
379
pub fn get_by_type_id ( & self , type_id : TypeId ) -> Option < & StaticVirtualChannel > {
378
380
self . channels . get ( & type_id)
379
381
}
380
382
381
- /// Gets a mutable reference to a [`StaticVirtualChannel`] by looking up its [`TypeId`].
383
+ /// Gets a mutable reference to a [`StaticVirtualChannel`] by looking up its internal [`StaticVirtualChannelProcessor`]'s [`TypeId`].
382
384
pub fn get_by_type_id_mut ( & mut self , type_id : TypeId ) -> Option < & mut StaticVirtualChannel > {
383
385
self . channels . get_mut ( & type_id)
384
386
}
385
387
386
- /// Gets a reference to a [`StaticVirtualChannel`] by looking up its [`TypeId`].
388
+ /// Gets a reference to a [`StaticVirtualChannel`] by looking up its internal [`StaticVirtualChannelProcessor`]'s [`TypeId`].
387
389
pub fn get_by_type < T : StaticVirtualChannelProcessor + ' static > ( & self ) -> Option < & StaticVirtualChannel > {
388
390
self . get_by_type_id ( TypeId :: of :: < T > ( ) )
389
391
}
390
392
391
- /// Gets a mutable reference to a [`StaticVirtualChannel`] by looking up its [`TypeId`].
393
+ /// Gets a mutable reference to a [`StaticVirtualChannel`] by looking up its internal [`StaticVirtualChannelProcessor`]'s [`TypeId`].
392
394
pub fn get_by_type_mut < T : StaticVirtualChannelProcessor + ' static > ( & mut self ) -> Option < & mut StaticVirtualChannel > {
393
395
self . get_by_type_id_mut ( TypeId :: of :: < T > ( ) )
394
396
}
0 commit comments