mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Remove unnecessary PeerId
parsing code
This commit is contained in:
parent
aa44de3d16
commit
21ab1bb434
@ -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…
Reference in New Issue
Block a user