Remove unnecessary PeerId
parsing code
This commit is contained in:
parent
aa44de3d16
commit
21ab1bb434
1 changed files with 0 additions and 18 deletions
|
@ -6,7 +6,6 @@ use prost::Message as _;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::any::{Any, TypeId};
|
use std::any::{Any, TypeId};
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::str::FromStr;
|
|
||||||
use std::{
|
use std::{
|
||||||
cmp,
|
cmp,
|
||||||
fmt::Debug,
|
fmt::Debug,
|
||||||
|
@ -119,23 +118,6 @@ impl fmt::Display for PeerId {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromStr for PeerId {
|
|
||||||
type Err = anyhow::Error;
|
|
||||||
|
|
||||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
|
||||||
let mut components = s.split('/');
|
|
||||||
let owner_id = components
|
|
||||||
.next()
|
|
||||||
.ok_or_else(|| anyhow!("invalid peer id {:?}", s))?
|
|
||||||
.parse()?;
|
|
||||||
let id = components
|
|
||||||
.next()
|
|
||||||
.ok_or_else(|| anyhow!("invalid peer id {:?}", s))?
|
|
||||||
.parse()?;
|
|
||||||
Ok(PeerId { owner_id, id })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
messages!(
|
messages!(
|
||||||
(Ack, Foreground),
|
(Ack, Foreground),
|
||||||
(AddProjectCollaborator, Foreground),
|
(AddProjectCollaborator, Foreground),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue