Skip to content

Commit

Permalink
Add a conversion from &str to CompleteStr
Browse files Browse the repository at this point in the history
  • Loading branch information
myrrlyn committed Mar 28, 2018
1 parent fb11984 commit 4b1a5a3
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use traits::{AsBytes, AtEof, Compare, CompareResult, ExtendInto, FindSubstring,
ParseTo, Slice};

use std::str::{self, CharIndices, Chars, FromStr};
use std::convert::From;
use std::ops::{Deref, Range, RangeFrom, RangeFull, RangeTo};
use std::iter::{Enumerate, Map};
use std::slice::Iter;
Expand All @@ -16,6 +17,12 @@ use std::slice::Iter;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub struct CompleteStr<'a>(pub &'a str);

impl<'a> From<&'a str> for CompleteStr<'a> {
fn from(src: &'a str) -> Self {
CompleteStr(src)
}
}

impl<'a> Deref for CompleteStr<'a> {
type Target = str;

Expand Down

0 comments on commit 4b1a5a3

Please sign in to comment.