Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Turn EncodeConfig functions const fn #51

Merged
merged 1 commit into from
Aug 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,29 +240,29 @@ impl HeaderMap {

impl EncodeConfig {
/// Create a new encode config with default values.
pub fn new() -> Self {
Self::default()
pub const fn new() -> Self {
Self {
line_ending: LineEnding::CRLF,
line_wrap: LINE_WRAP,
}
}

/// Set the line ending to use for the encoding.
pub fn set_line_ending(mut self, line_ending: LineEnding) -> Self {
pub const fn set_line_ending(mut self, line_ending: LineEnding) -> Self {
self.line_ending = line_ending;
self
}

/// Set the line length to use for the encoding.
pub fn set_line_wrap(mut self, line_wrap: usize) -> Self {
pub const fn set_line_wrap(mut self, line_wrap: usize) -> Self {
self.line_wrap = line_wrap;
self
}
}

impl Default for EncodeConfig {
fn default() -> Self {
Self {
line_ending: LineEnding::CRLF,
line_wrap: LINE_WRAP,
}
Self::new()
}
}

Expand Down