aboutsummaryrefslogtreecommitdiff
path: root/src/client.rs
diff options
context:
space:
mode:
authorHenauxg <19689618+Henauxg@users.noreply.github.com>2023-01-16 19:40:57 +0100
committerHenauxg <19689618+Henauxg@users.noreply.github.com>2023-01-16 19:40:57 +0100
commitd3b063dbb5595c2609ded29f0cd8cc90de40fff8 (patch)
tree96aa71b87b7e55e99a610ba9dddbf887f3472246 /src/client.rs
parente7790f2be7a5c7a7632e6b23079f54d6dab45766 (diff)
[channels] Add doc strings
Diffstat (limited to 'src/client.rs')
-rw-r--r--src/client.rs14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/client.rs b/src/client.rs
index 8a1eee5..6416395 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -301,6 +301,13 @@ impl Connection {
}
}
+ /// Opens a channel of the requested [ChannelType] and returns its [ChannelId].
+ ///
+ /// By default, when starting a [Connection]], Quinnet creates 1 channel instance of each [ChannelType], each with their own [ChannelId]. Among those, there is a `default` channel which will be used when you don't specify the channel. At startup, this default channel is a [ChannelType::OrderedReliable] channel.
+ ///
+ /// If no channels were previously opened, the opened channel will be the new default channel.
+ ///
+ /// Can fail if the Connection is closed.
pub fn open_channel(&mut self, channel_type: ChannelType) -> Result<ChannelId, QuinnetError> {
let channel_id = get_channel_id_from_type(channel_type, || {
self.last_gen_id += 1;
@@ -312,10 +319,11 @@ impl Connection {
}
}
- /// Immediately prevents new messages from being sent on the channel and signal the channel to closes all its background tasks.
- /// Before trully closing, the channel will wait for all buffered messages to be properly sent according to the channel type.
+ /// Closes the channel with the corresponding [ChannelId].
+ ///
+ /// No new messages will be able to be sent on this channel, however, the channel will properly try to send all the messages that were previously pushed to it, according to its [ChannelType], before fully closing.
///
- /// If called on the default channel, set default channel to None.
+ /// If the closed channel is the current default channel, the default channel gets set to `None`.
///
/// Can fail if the [ChannelId] is unknown, or if the channel is already closed.
pub fn close_channel(&mut self, channel_id: ChannelId) -> Result<(), QuinnetError> {