Skip to content

Commit 41bea1a

Browse files
committed
Use 'static lifetime for Encoding reference
1 parent ef3ea6a commit 41bea1a

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/lib.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,15 +140,15 @@ impl Display for PropertiesError {
140140
struct NaturalLine(usize, String);
141141

142142
// We can't use BufRead.lines() because it doesn't use the proper line endings
143-
struct NaturalLines<'a, R: Read> {
143+
struct NaturalLines<R: Read> {
144144
bytes: Peekable<Bytes<R>>,
145145
eof: bool,
146146
line_count: usize,
147-
encoding: &'a Encoding,
147+
encoding: &'static Encoding,
148148
}
149149

150-
impl<'a, R: Read> NaturalLines<'a, R> {
151-
fn new(reader: R, encoding: &'a Encoding) -> Self {
150+
impl<R: Read> NaturalLines<R> {
151+
fn new(reader: R, encoding: &'static Encoding) -> Self {
152152
NaturalLines {
153153
bytes: reader.bytes().peekable(),
154154
eof: false,
@@ -168,7 +168,7 @@ impl<'a, R: Read> NaturalLines<'a, R> {
168168
const LF: u8 = 10;
169169
const CR: u8 = 13;
170170

171-
impl<'a, R: Read> Iterator for NaturalLines<'a, R> {
171+
impl<R: Read> Iterator for NaturalLines<R> {
172172
type Item = Result<NaturalLine, PropertiesError>;
173173

174174
fn next(&mut self) -> Option<Self::Item> {
@@ -487,12 +487,12 @@ impl LineParser {
487487
///
488488
/// For basic usage, see the crate-level documentation.
489489
/// Note that once `next` returns an error, the result of further calls is undefined.
490-
pub struct PropertiesIter<'a, R: Read> {
491-
lines: LogicalLines<NaturalLines<'a, R>>,
490+
pub struct PropertiesIter<R: Read> {
491+
lines: LogicalLines<NaturalLines<R>>,
492492
parser: LineParser,
493493
}
494494

495-
impl<'a, R: Read> PropertiesIter<'a, R> {
495+
impl<R: Read> PropertiesIter<R> {
496496
/// Parses properties from the given `Read` stream.
497497
pub fn new(input: R) -> Self {
498498
Self::new_with_encoding(input, ISO_8859_1)
@@ -501,7 +501,7 @@ impl<'a, R: Read> PropertiesIter<'a, R> {
501501
/// Parses properties from the given `Read` stream in the given encoding.
502502
/// Note that the Java properties specification specifies ISO-8859-1 encoding
503503
/// for properties files; in most cases, `new` should be called instead.
504-
pub fn new_with_encoding(input: R, encoding: Box<Encoding>) -> Self {
504+
pub fn new_with_encoding(input: R, encoding: &'static Encoding) -> Self {
505505
PropertiesIter {
506506
lines: LogicalLines::new(NaturalLines::new(input, encoding)),
507507
parser: LineParser::new(),
@@ -541,7 +541,7 @@ impl<'a, R: Read> PropertiesIter<'a, R> {
541541
}
542542

543543
/// Note that once `next` returns an error, the result of further calls is undefined.
544-
impl<'a, R: Read> Iterator for PropertiesIter<'a, R> {
544+
impl<R: Read> Iterator for PropertiesIter<R> {
545545
type Item = Result<Line, PropertiesError>;
546546

547547
/// Returns the next line.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy