-
Notifications
You must be signed in to change notification settings - Fork 563
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change DOS line endings to UNIX line endings
- Loading branch information
Showing
2 changed files
with
1,801 additions
and
1,801 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,50 @@ | ||
/// Settings for the cache. | ||
/// | ||
/// # Examples | ||
/// | ||
/// Create new settings, specifying the maximum number of messages: | ||
/// | ||
/// ```rust | ||
/// use serenity::cache::Settings as CacheSettings; | ||
/// | ||
/// let mut settings = CacheSettings::new(); | ||
/// settings.max_messages(10); | ||
/// ``` | ||
#[derive(Clone, Debug, Default)] | ||
pub struct Settings { | ||
/// The maximum number of messages to store in a channel's message cache. | ||
/// | ||
/// Defaults to 0. | ||
pub max_messages: usize, | ||
__nonexhaustive: (), | ||
} | ||
|
||
impl Settings { | ||
/// Creates new settings to be used with a cache. | ||
#[inline] | ||
pub fn new() -> Self { | ||
Self::default() | ||
} | ||
|
||
/// Sets the maximum number of messages to cache in a channel. | ||
/// | ||
/// Refer to [`max_messages`] for more information. | ||
/// | ||
/// # Examples | ||
/// | ||
/// Set the maximum number of messages to cache: | ||
/// | ||
/// ```rust | ||
/// use serenity::cache::Settings; | ||
/// | ||
/// let mut settings = Settings::new(); | ||
/// settings.max_messages(10); | ||
/// ``` | ||
/// | ||
/// [`max_messages`]: #structfield.max_messages | ||
pub fn max_messages(&mut self, max: usize) -> &mut Self { | ||
self.max_messages = max; | ||
|
||
self | ||
} | ||
} | ||
/// Settings for the cache. | ||
/// | ||
/// # Examples | ||
/// | ||
/// Create new settings, specifying the maximum number of messages: | ||
/// | ||
/// ```rust | ||
/// use serenity::cache::Settings as CacheSettings; | ||
/// | ||
/// let mut settings = CacheSettings::new(); | ||
/// settings.max_messages(10); | ||
/// ``` | ||
#[derive(Clone, Debug, Default)] | ||
pub struct Settings { | ||
/// The maximum number of messages to store in a channel's message cache. | ||
/// | ||
/// Defaults to 0. | ||
pub max_messages: usize, | ||
__nonexhaustive: (), | ||
} | ||
|
||
impl Settings { | ||
/// Creates new settings to be used with a cache. | ||
#[inline] | ||
pub fn new() -> Self { | ||
Self::default() | ||
} | ||
|
||
/// Sets the maximum number of messages to cache in a channel. | ||
/// | ||
/// Refer to [`max_messages`] for more information. | ||
/// | ||
/// # Examples | ||
/// | ||
/// Set the maximum number of messages to cache: | ||
/// | ||
/// ```rust | ||
/// use serenity::cache::Settings; | ||
/// | ||
/// let mut settings = Settings::new(); | ||
/// settings.max_messages(10); | ||
/// ``` | ||
/// | ||
/// [`max_messages`]: #structfield.max_messages | ||
pub fn max_messages(&mut self, max: usize) -> &mut Self { | ||
self.max_messages = max; | ||
|
||
self | ||
} | ||
} |
Oops, something went wrong.