mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
97c53bfa24
commit
f9aad2cb08
2 changed files with 5 additions and 5 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
use std::collections::HashMap;
|
use std::{borrow::Cow, collections::HashMap};
|
||||||
|
|
||||||
use mlua::{ExternalResult, IntoLua, Lua, Value};
|
use mlua::{ExternalResult, IntoLua, Lua, Value};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
@ -9,13 +9,13 @@ use crate::Peer;
|
||||||
#[derive(Debug, Serialize, Deserialize)]
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
pub struct BodyHey {
|
pub struct BodyHey {
|
||||||
pub peers: HashMap<u64, Peer>,
|
pub peers: HashMap<u64, Peer>,
|
||||||
pub version: String,
|
pub version: Cow<'static, str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl BodyHey {
|
impl BodyHey {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn owned(peers: HashMap<u64, Peer>) -> Body<'static> {
|
pub fn owned(peers: HashMap<u64, Peer>) -> Body<'static> {
|
||||||
Self { peers, version: BodyHi::version().to_string() }.into()
|
Self { peers, version: BodyHi::version().into() }.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ use super::Body;
|
||||||
pub struct BodyHi<'a> {
|
pub struct BodyHi<'a> {
|
||||||
/// Specifies the kinds of events that the client can handle
|
/// Specifies the kinds of events that the client can handle
|
||||||
pub abilities: HashSet<Cow<'a, str>>,
|
pub abilities: HashSet<Cow<'a, str>>,
|
||||||
pub version: String,
|
pub version: Cow<'static, str>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> BodyHi<'a> {
|
impl<'a> BodyHi<'a> {
|
||||||
|
|
@ -18,7 +18,7 @@ impl<'a> BodyHi<'a> {
|
||||||
pub fn borrowed(abilities: HashSet<&'a str>) -> Body<'a> {
|
pub fn borrowed(abilities: HashSet<&'a str>) -> Body<'a> {
|
||||||
Self {
|
Self {
|
||||||
abilities: abilities.into_iter().map(Cow::Borrowed).collect(),
|
abilities: abilities.into_iter().map(Cow::Borrowed).collect(),
|
||||||
version: Self::version().to_string(),
|
version: Self::version().into(),
|
||||||
}
|
}
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue