tor-linkspec: Add a constructor for UnparsedLinkSpec
This commit is contained in:
parent
e60ab8087d
commit
7129807843
|
@ -0,0 +1 @@
|
||||||
|
ADDED: Constructor for UnparedLinkSpec
|
|
@ -160,6 +160,16 @@ pub struct UnparsedLinkSpec {
|
||||||
body: Vec<u8>,
|
body: Vec<u8>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl UnparsedLinkSpec {
|
||||||
|
/// Create a new `UnparsedLinkSpec`.
|
||||||
|
pub fn new(lstype: u8, body: impl Into<Vec<u8>>) -> Self {
|
||||||
|
UnparsedLinkSpec {
|
||||||
|
lstype,
|
||||||
|
body: body.into(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Readable for UnparsedLinkSpec {
|
impl Readable for UnparsedLinkSpec {
|
||||||
fn take_from(r: &mut Reader<'_>) -> Result<Self> {
|
fn take_from(r: &mut Reader<'_>) -> Result<Self> {
|
||||||
let lstype = r.take_u8()?;
|
let lstype = r.take_u8()?;
|
||||||
|
|
Loading…
Reference in New Issue