Skip to content

Commit 4509575

Browse files
Merge pull request #138 from AlephAlpha/master
Make methods of `Config` const functions
2 parents ad13ec7 + e4efff3 commit 4509575

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub struct Config {
161161

162162
impl Config {
163163
/// Create a new `Config`.
164-
pub fn new(char_set: CharacterSet, pad: bool) -> Config {
164+
pub const fn new(char_set: CharacterSet, pad: bool) -> Config {
165165
Config {
166166
char_set,
167167
pad,
@@ -170,15 +170,15 @@ impl Config {
170170
}
171171

172172
/// Sets whether to pad output with `=` characters.
173-
pub fn pad(self, pad: bool) -> Config {
173+
pub const fn pad(self, pad: bool) -> Config {
174174
Config { pad, ..self }
175175
}
176176

177177
/// Sets whether to emit errors for nonzero trailing bits.
178178
///
179179
/// This is useful when implementing
180180
/// [forgiving-base64 decode](https://infra.spec.whatwg.org/#forgiving-base64-decode).
181-
pub fn decode_allow_trailing_bits(self, allow: bool) -> Config {
181+
pub const fn decode_allow_trailing_bits(self, allow: bool) -> Config {
182182
Config {
183183
decode_allow_trailing_bits: allow,
184184
..self
@@ -236,7 +236,7 @@ pub const IMAP_MUTF7: Config = Config {
236236
};
237237

238238
/// BinHex character set
239-
pub const BINHEX : Config = Config {
239+
pub const BINHEX: Config = Config {
240240
char_set: CharacterSet::BinHex,
241241
pad: false,
242242
decode_allow_trailing_bits: false,

0 commit comments

Comments
 (0)