muc: Document more constructors.

This commit is contained in:
Emmanuel Gil Peyrot 2018-11-02 16:28:40 +01:00
parent e2c0068af9
commit c420c87bf5

View file

@ -28,6 +28,7 @@ generate_element!(
); );
impl History { impl History {
/// Create a new empty history element.
pub fn new() -> Self { pub fn new() -> Self {
History { History {
maxchars: None, maxchars: None,
@ -37,21 +38,25 @@ impl History {
} }
} }
/// Set how many characters of history to send.
pub fn with_maxchars(mut self, maxchars: u32) -> Self { pub fn with_maxchars(mut self, maxchars: u32) -> Self {
self.maxchars = Some(maxchars); self.maxchars = Some(maxchars);
self self
} }
/// Set how many messages to send.
pub fn with_maxstanzas(mut self, maxstanzas: u32) -> Self { pub fn with_maxstanzas(mut self, maxstanzas: u32) -> Self {
self.maxstanzas = Some(maxstanzas); self.maxstanzas = Some(maxstanzas);
self self
} }
/// Only send messages received in these last seconds.
pub fn with_seconds(mut self, seconds: u32) -> Self { pub fn with_seconds(mut self, seconds: u32) -> Self {
self.seconds = Some(seconds); self.seconds = Some(seconds);
self self
} }
/// Only send messages received since this date.
pub fn with_since(mut self, since: DateTime) -> Self { pub fn with_since(mut self, since: DateTime) -> Self {
self.since = Some(since); self.since = Some(since);
self self
@ -73,6 +78,7 @@ generate_element!(
impl PresencePayload for Muc {} impl PresencePayload for Muc {}
impl Muc { impl Muc {
/// Create a new MUC join element.
pub fn new() -> Self { pub fn new() -> Self {
Muc { Muc {
password: None, password: None,
@ -80,11 +86,13 @@ impl Muc {
} }
} }
/// Join a room with this password.
pub fn with_password(mut self, password: String) -> Self { pub fn with_password(mut self, password: String) -> Self {
self.password = Some(password); self.password = Some(password);
self self
} }
/// Join a room with only that much history.
pub fn with_history(mut self, history: History) -> Self { pub fn with_history(mut self, history: History) -> Self {
self.history = Some(history); self.history = Some(history);
self self