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

Impl of Indented should add ?Sized to its constraint #21

Open
AstrickHarren opened this issue Jan 23, 2024 · 0 comments
Open

Impl of Indented should add ?Sized to its constraint #21

AstrickHarren opened this issue Jan 23, 2024 · 0 comments

Comments

@AstrickHarren
Copy link

AstrickHarren commented Jan 23, 2024

Here

indenter/src/lib.rs

Lines 183 to 199 in 4574396

impl<'a, D> Indented<'a, D> {
/// Sets the format to `Format::Numbered` with the provided index
pub fn ind(self, ind: usize) -> Self {
self.with_format(Format::Numbered { ind })
}
/// Sets the format to `Format::Uniform` with the provided static string
pub fn with_str(self, indentation: &'static str) -> Self {
self.with_format(Format::Uniform { indentation })
}
/// Construct an indenter with a user defined format
pub fn with_format(mut self, format: Format<'a>) -> Self {
self.format = format;
self
}
}

It will be much helpful if ?Sized is added to as the constraint of the impl so that such a type as D = Box<dyn Write> can take advantage of the use of the methods. One line of code change.

See also #16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant