UntrastedRlp
This commit is contained in:
parent
d6d51b456b
commit
b0c38cb6ec
22
src/rlp.rs
22
src/rlp.rs
@ -155,31 +155,31 @@ impl From<FromBytesError> for DecoderError {
|
|||||||
///
|
///
|
||||||
/// It assumes that you know what you are doing. Doesn't bother
|
/// It assumes that you know what you are doing. Doesn't bother
|
||||||
/// you with error handling.
|
/// you with error handling.
|
||||||
pub struct UnsafeRlp<'a> {
|
pub struct UntrustedRlp<'a> {
|
||||||
rlp: Rlp<'a>
|
rlp: Rlp<'a>
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<Rlp<'a>> for UnsafeRlp<'a> {
|
impl<'a> From<Rlp<'a>> for UntrustedRlp<'a> {
|
||||||
fn from(rlp: Rlp<'a>) -> UnsafeRlp<'a> {
|
fn from(rlp: Rlp<'a>) -> UntrustedRlp<'a> {
|
||||||
UnsafeRlp { rlp: rlp }
|
UntrustedRlp { rlp: rlp }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> From<UnsafeRlp<'a>> for Rlp<'a> {
|
impl<'a> From<UntrustedRlp<'a>> for Rlp<'a> {
|
||||||
fn from(unsafe_rlp: UnsafeRlp<'a>) -> Rlp<'a> {
|
fn from(unsafe_rlp: UntrustedRlp<'a>) -> Rlp<'a> {
|
||||||
unsafe_rlp.rlp
|
unsafe_rlp.rlp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> UnsafeRlp<'a> {
|
impl<'a> UntrustedRlp<'a> {
|
||||||
/// returns new instance of `UnsafeRlp`
|
/// returns new instance of `UntrustedRlp`
|
||||||
pub fn new(bytes: &'a [u8]) -> UnsafeRlp<'a> {
|
pub fn new(bytes: &'a [u8]) -> UntrustedRlp<'a> {
|
||||||
UnsafeRlp {
|
UntrustedRlp {
|
||||||
rlp: Rlp::new(bytes)
|
rlp: Rlp::new(bytes)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn at(&self, index: usize) -> UnsafeRlp<'a> {
|
pub fn at(&self, index: usize) -> UntrustedRlp<'a> {
|
||||||
From::from(self.rlp.at(index).unwrap())
|
From::from(self.rlp.at(index).unwrap())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user