Add deref impl
This commit is contained in:
parent
125cf814c7
commit
cd7dd5fed7
1 changed files with 17 additions and 0 deletions
17
src/lib.rs
17
src/lib.rs
|
@ -2,6 +2,7 @@ use std::{
|
||||||
borrow::{Borrow, Cow},
|
borrow::{Borrow, Cow},
|
||||||
fmt::{Debug, Display},
|
fmt::{Debug, Display},
|
||||||
marker::PhantomData,
|
marker::PhantomData,
|
||||||
|
ops::Deref,
|
||||||
str::{from_utf8, Utf8Error},
|
str::{from_utf8, Utf8Error},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -309,6 +310,22 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<Inner, Segment> Deref for Node<Inner, Segment> {
|
||||||
|
type Target = Segment;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
self.segment()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<Inner, Segment> Deref for Field<Inner, Segment> {
|
||||||
|
type Target = Segment;
|
||||||
|
|
||||||
|
fn deref(&self) -> &Self::Target {
|
||||||
|
self.segment()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mod hidden {
|
mod hidden {
|
||||||
pub trait Construct {
|
pub trait Construct {
|
||||||
fn construct(&self) -> Vec<u8>;
|
fn construct(&self) -> Vec<u8>;
|
||||||
|
|
Loading…
Reference in a new issue