aboutsummaryrefslogtreecommitdiff
path: root/src/reader.rs
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2023-08-11 21:42:18 +0200
committerMartin Fischer <martin@push-f.com>2023-08-19 06:41:55 +0200
commit36fbad12e7a50fcae3cc5e9e2d2baccd828115a5 (patch)
treec200a7dc3feb3bf869c99beab01f5dbf9d12ce4c /src/reader.rs
parentc00d5cdec03364f064a1273a5d806f3600abf09a (diff)
break!: rename Readable to IntoReader
The trait of the standard library is also called IntoIterator and not Iterable.
Diffstat (limited to 'src/reader.rs')
-rw-r--r--src/reader.rs24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/reader.rs b/src/reader.rs
index eb2b479..6067c47 100644
--- a/src/reader.rs
+++ b/src/reader.rs
@@ -31,18 +31,18 @@ pub trait Reader {
///
/// For example, any utf8-string can be converted into a `StringReader`, such that
/// `Tokenizer::new("mystring")` and `Tokenizer::new(&String::new("foo"))` work.
-pub trait Readable<'a> {
- /// The reader type to which this type should be converted.
+pub trait IntoReader<'a> {
+ /// The reader type into which this type should be converted.
type Reader: Reader + 'a;
- /// Convert self to some sort of reader.
- fn to_reader(self) -> Self::Reader;
+ /// Convert self into some sort of reader.
+ fn into_reader(self) -> Self::Reader;
}
-impl<'a, R: 'a + Reader> Readable<'a> for R {
+impl<'a, R: 'a + Reader> IntoReader<'a> for R {
type Reader = Self;
- fn to_reader(self) -> Self::Reader {
+ fn into_reader(self) -> Self::Reader {
self
}
}
@@ -120,18 +120,18 @@ impl<'a> Reader for StringReader<'a> {
}
}
-impl<'a> Readable<'a> for &'a str {
+impl<'a> IntoReader<'a> for &'a str {
type Reader = StringReader<'a>;
- fn to_reader(self) -> Self::Reader {
+ fn into_reader(self) -> Self::Reader {
StringReader::new(self)
}
}
-impl<'a> Readable<'a> for &'a String {
+impl<'a> IntoReader<'a> for &'a String {
type Reader = StringReader<'a>;
- fn to_reader(self) -> Self::Reader {
+ fn into_reader(self) -> Self::Reader {
StringReader::new(self.as_str())
}
}
@@ -225,10 +225,10 @@ impl<R: BufRead> Reader for BufReadReader<R> {
}
}
-impl<'a, R: Read + 'a> Readable<'a> for BufReader<R> {
+impl<'a, R: Read + 'a> IntoReader<'a> for BufReader<R> {
type Reader = BufReadReader<BufReader<R>>;
- fn to_reader(self) -> Self::Reader {
+ fn into_reader(self) -> Self::Reader {
BufReadReader::new(self)
}
}