New clipps lints
This commit is contained in:
parent
fb5171b42f
commit
4967e9aa37
@ -40,7 +40,7 @@ impl Player {
|
|||||||
let window_title = container
|
let window_title = container
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|container| container.window_name())
|
.map(|container| container.window_name())
|
||||||
.unwrap_or(inventory.window_name());
|
.unwrap_or_else(|| inventory.window_name());
|
||||||
let title = TextComponent::text(window_title);
|
let title = TextComponent::text(window_title);
|
||||||
|
|
||||||
self.client.send_packet(&COpenScreen::new(
|
self.client.send_packet(&COpenScreen::new(
|
||||||
@ -64,13 +64,12 @@ impl Player {
|
|||||||
.map(Slot::from)
|
.map(Slot::from)
|
||||||
.collect_vec();
|
.collect_vec();
|
||||||
|
|
||||||
let carried_item = {
|
let carried_item = self
|
||||||
if let Some(item) = self.carried_item.load().as_ref() {
|
.carried_item
|
||||||
item.into()
|
.load()
|
||||||
} else {
|
.as_ref()
|
||||||
Slot::empty()
|
.map_or_else(Slot::empty, |item| item.into());
|
||||||
}
|
|
||||||
};
|
|
||||||
// Gets the previous value
|
// Gets the previous value
|
||||||
let i = inventory
|
let i = inventory
|
||||||
.state_id
|
.state_id
|
||||||
@ -378,7 +377,7 @@ impl Player {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_current_players_in_container(&self, server: &Server) -> Vec<Arc<Player>> {
|
async fn get_current_players_in_container(&self, server: &Server) -> Vec<Arc<Self>> {
|
||||||
let player_ids = {
|
let player_ids = {
|
||||||
let open_containers = server.open_containers.read();
|
let open_containers = server.open_containers.read();
|
||||||
open_containers
|
open_containers
|
||||||
@ -453,10 +452,8 @@ impl Player {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_open_container(&self, server: &Server) -> Option<Arc<Mutex<Box<dyn Container>>>> {
|
pub fn get_open_container(&self, server: &Server) -> Option<Arc<Mutex<Box<dyn Container>>>> {
|
||||||
if let Some(id) = self.open_container.load() {
|
self.open_container
|
||||||
server.try_get_container(self.entity_id(), id)
|
.load()
|
||||||
} else {
|
.map_or_else(|| None, |id| server.try_get_container(self.entity_id(), id))
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -371,7 +371,7 @@ impl Client {
|
|||||||
match self.connection_state.load() {
|
match self.connection_state.load() {
|
||||||
ConnectionState::Login => {
|
ConnectionState::Login => {
|
||||||
self.try_send_packet(&CLoginDisconnect::new(
|
self.try_send_packet(&CLoginDisconnect::new(
|
||||||
&serde_json::to_string_pretty(&reason).unwrap_or("".into()),
|
&serde_json::to_string_pretty(&reason).unwrap_or_else(|_| "".into()),
|
||||||
))
|
))
|
||||||
.unwrap_or_else(|_| self.close());
|
.unwrap_or_else(|_| self.close());
|
||||||
}
|
}
|
||||||
|
|||||||
@ -110,9 +110,9 @@ impl Player {
|
|||||||
&[self.client.token],
|
&[self.client.token],
|
||||||
&CUpdateEntityPos::new(
|
&CUpdateEntityPos::new(
|
||||||
entity_id.into(),
|
entity_id.into(),
|
||||||
(x * 4096.0 - lastx * 4096.0) as i16,
|
x.mul_add(4096.0, -(lastx * 4096.0)) as i16,
|
||||||
(y * 4096.0 - lasty * 4096.0) as i16,
|
y.mul_add(4096.0, -(lasty * 4096.0)) as i16,
|
||||||
(z * 4096.0 - lastz * 4096.0) as i16,
|
z.mul_add(4096.0, -(lastz * 4096.0)) as i16,
|
||||||
position.ground,
|
position.ground,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -180,9 +180,9 @@ impl Player {
|
|||||||
&[self.client.token],
|
&[self.client.token],
|
||||||
&CUpdateEntityPosRot::new(
|
&CUpdateEntityPosRot::new(
|
||||||
entity_id.into(),
|
entity_id.into(),
|
||||||
(x * 4096.0 - lastx * 4096.0) as i16,
|
x.mul_add(4096.0, -(lastx * 4096.0)) as i16,
|
||||||
(y * 4096.0 - lasty * 4096.0) as i16,
|
y.mul_add(4096.0, -(lasty * 4096.0)) as i16,
|
||||||
(z * 4096.0 - lastz * 4096.0) as i16,
|
z.mul_add(4096.0, -(lastz * 4096.0)) as i16,
|
||||||
yaw as u8,
|
yaw as u8,
|
||||||
pitch as u8,
|
pitch as u8,
|
||||||
position_rotation.ground,
|
position_rotation.ground,
|
||||||
|
|||||||
@ -7,7 +7,7 @@ const NAMES: [&str; 2] = ["echest", "enderchest"];
|
|||||||
const DESCRIPTION: &str =
|
const DESCRIPTION: &str =
|
||||||
"Show your personal enderchest (this command is used for testing container behaviour)";
|
"Show your personal enderchest (this command is used for testing container behaviour)";
|
||||||
|
|
||||||
pub(crate) fn init_command_tree<'a>() -> CommandTree<'a> {
|
pub fn init_command_tree<'a>() -> CommandTree<'a> {
|
||||||
CommandTree::new(NAMES, DESCRIPTION).execute(&|sender, server, _| {
|
CommandTree::new(NAMES, DESCRIPTION).execute(&|sender, server, _| {
|
||||||
if let Some(player) = sender.as_mut_player() {
|
if let Some(player) = sender.as_mut_player() {
|
||||||
let entity_id = player.entity_id();
|
let entity_id = player.entity_id();
|
||||||
|
|||||||
@ -56,7 +56,7 @@ pub fn parse_arg_gamemode(consumed_args: &ConsumedArgs) -> Result<GameMode, Inva
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn init_command_tree<'a>() -> CommandTree<'a> {
|
pub fn init_command_tree<'a>() -> CommandTree<'a> {
|
||||||
CommandTree::new(NAMES, DESCRIPTION).with_child(
|
CommandTree::new(NAMES, DESCRIPTION).with_child(
|
||||||
require(&|sender| sender.permission_lvl() >= 2).with_child(
|
require(&|sender| sender.permission_lvl() >= 2).with_child(
|
||||||
argument(ARG_GAMEMODE, consume_arg_gamemode)
|
argument(ARG_GAMEMODE, consume_arg_gamemode)
|
||||||
|
|||||||
@ -32,7 +32,7 @@ fn parse_arg_command<'a>(
|
|||||||
.map_err(|_| InvalidConsumptionError(Some(command_name.into())))
|
.map_err(|_| InvalidConsumptionError(Some(command_name.into())))
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn init_command_tree<'a>() -> CommandTree<'a> {
|
pub fn init_command_tree<'a>() -> CommandTree<'a> {
|
||||||
CommandTree::new(NAMES, DESCRIPTION)
|
CommandTree::new(NAMES, DESCRIPTION)
|
||||||
.with_child(
|
.with_child(
|
||||||
argument(ARG_COMMAND, consume_arg_command).execute(&|sender, server, args| {
|
argument(ARG_COMMAND, consume_arg_command).execute(&|sender, server, args| {
|
||||||
|
|||||||
@ -14,7 +14,7 @@ pub fn consume_arg_target(_src: &CommandSender, args: &mut RawArgs) -> Option<St
|
|||||||
consume_arg_player(_src, args)
|
consume_arg_player(_src, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn init_command_tree<'a>() -> CommandTree<'a> {
|
pub fn init_command_tree<'a>() -> CommandTree<'a> {
|
||||||
CommandTree::new(NAMES, DESCRIPTION).with_child(
|
CommandTree::new(NAMES, DESCRIPTION).with_child(
|
||||||
argument(ARG_TARGET, consume_arg_target).execute(&|sender, server, args| {
|
argument(ARG_TARGET, consume_arg_target).execute(&|sender, server, args| {
|
||||||
let target = parse_arg_player(sender, server, ARG_TARGET, args)?;
|
let target = parse_arg_player(sender, server, ARG_TARGET, args)?;
|
||||||
|
|||||||
@ -8,7 +8,7 @@ const NAMES: [&str; 1] = ["pumpkin"];
|
|||||||
|
|
||||||
const DESCRIPTION: &str = "Display information about Pumpkin.";
|
const DESCRIPTION: &str = "Display information about Pumpkin.";
|
||||||
|
|
||||||
pub(crate) fn init_command_tree<'a>() -> CommandTree<'a> {
|
pub fn init_command_tree<'a>() -> CommandTree<'a> {
|
||||||
CommandTree::new(NAMES, DESCRIPTION).execute(&|sender, _, _| {
|
CommandTree::new(NAMES, DESCRIPTION).execute(&|sender, _, _| {
|
||||||
let version = env!("CARGO_PKG_VERSION");
|
let version = env!("CARGO_PKG_VERSION");
|
||||||
let description = env!("CARGO_PKG_DESCRIPTION");
|
let description = env!("CARGO_PKG_DESCRIPTION");
|
||||||
|
|||||||
@ -8,7 +8,7 @@ const NAMES: [&str; 1] = ["stop"];
|
|||||||
|
|
||||||
const DESCRIPTION: &str = "Stop the server.";
|
const DESCRIPTION: &str = "Stop the server.";
|
||||||
|
|
||||||
pub(crate) fn init_command_tree<'a>() -> CommandTree<'a> {
|
pub fn init_command_tree<'a>() -> CommandTree<'a> {
|
||||||
CommandTree::new(NAMES, DESCRIPTION).with_child(
|
CommandTree::new(NAMES, DESCRIPTION).with_child(
|
||||||
require(&|sender| sender.permission_lvl() >= 4).execute(&|sender, _, _args| {
|
require(&|sender| sender.permission_lvl() >= 4).execute(&|sender, _, _args| {
|
||||||
sender
|
sender
|
||||||
|
|||||||
@ -35,7 +35,7 @@ impl<'a> CommandSender<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_player(&self) -> bool {
|
pub const fn is_player(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
CommandSender::Console => false,
|
CommandSender::Console => false,
|
||||||
CommandSender::Player(_) => true,
|
CommandSender::Player(_) => true,
|
||||||
@ -43,7 +43,7 @@ impl<'a> CommandSender<'a> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_console(&self) -> bool {
|
pub const fn is_console(&self) -> bool {
|
||||||
match self {
|
match self {
|
||||||
CommandSender::Console => true,
|
CommandSender::Console => true,
|
||||||
CommandSender::Player(_) => false,
|
CommandSender::Player(_) => false,
|
||||||
@ -59,7 +59,7 @@ impl<'a> CommandSender<'a> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// todo: implement
|
/// todo: implement
|
||||||
pub fn permission_lvl(&self) -> i32 {
|
pub const fn permission_lvl(&self) -> i32 {
|
||||||
match self {
|
match self {
|
||||||
CommandSender::Rcon(_) => 4,
|
CommandSender::Rcon(_) => 4,
|
||||||
CommandSender::Console => 4,
|
CommandSender::Console => 4,
|
||||||
|
|||||||
@ -3,20 +3,20 @@ use crate::commands::CommandSender;
|
|||||||
use std::collections::{HashMap, VecDeque};
|
use std::collections::{HashMap, VecDeque};
|
||||||
|
|
||||||
/// see [crate::commands::tree_builder::argument]
|
/// see [crate::commands::tree_builder::argument]
|
||||||
pub(crate) type RawArgs<'a> = Vec<&'a str>;
|
pub type RawArgs<'a> = Vec<&'a str>;
|
||||||
|
|
||||||
/// see [crate::commands::tree_builder::argument] and [CommandTree::execute]/[crate::commands::tree_builder::NonLeafNodeBuilder::execute]
|
/// see [crate::commands::tree_builder::argument] and [CommandTree::execute]/[crate::commands::tree_builder::NonLeafNodeBuilder::execute]
|
||||||
pub(crate) type ConsumedArgs<'a> = HashMap<&'a str, String>;
|
pub type ConsumedArgs<'a> = HashMap<&'a str, String>;
|
||||||
|
|
||||||
/// see [crate::commands::tree_builder::argument]
|
/// see [crate::commands::tree_builder::argument]
|
||||||
pub(crate) type ArgumentConsumer<'a> = fn(&CommandSender, &mut RawArgs) -> Option<String>;
|
pub type ArgumentConsumer<'a> = fn(&CommandSender, &mut RawArgs) -> Option<String>;
|
||||||
|
|
||||||
pub(crate) struct Node<'a> {
|
pub struct Node<'a> {
|
||||||
pub(crate) children: Vec<usize>,
|
pub(crate) children: Vec<usize>,
|
||||||
pub(crate) node_type: NodeType<'a>,
|
pub(crate) node_type: NodeType<'a>,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) enum NodeType<'a> {
|
pub enum NodeType<'a> {
|
||||||
ExecuteLeaf {
|
ExecuteLeaf {
|
||||||
run: &'a RunFunctionType,
|
run: &'a RunFunctionType,
|
||||||
},
|
},
|
||||||
@ -32,12 +32,12 @@ pub(crate) enum NodeType<'a> {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) enum Command<'a> {
|
pub enum Command<'a> {
|
||||||
Tree(CommandTree<'a>),
|
Tree(CommandTree<'a>),
|
||||||
Alias(&'a str),
|
Alias(&'a str),
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct CommandTree<'a> {
|
pub struct CommandTree<'a> {
|
||||||
pub(crate) nodes: Vec<Node<'a>>,
|
pub(crate) nodes: Vec<Node<'a>>,
|
||||||
pub(crate) children: Vec<usize>,
|
pub(crate) children: Vec<usize>,
|
||||||
pub(crate) names: Vec<&'a str>,
|
pub(crate) names: Vec<&'a str>,
|
||||||
|
|||||||
@ -101,7 +101,7 @@ impl<'a> NodeBuilder<'a> for NonLeafNodeBuilder<'a> {
|
|||||||
|
|
||||||
impl<'a> NonLeafNodeBuilder<'a> {
|
impl<'a> NonLeafNodeBuilder<'a> {
|
||||||
/// Add a child [Node] to this one.
|
/// Add a child [Node] to this one.
|
||||||
pub fn with_child(mut self, child: NonLeafNodeBuilder<'a>) -> Self {
|
pub fn with_child(mut self, child: Self) -> Self {
|
||||||
self.child_nodes.push(child);
|
self.child_nodes.push(child);
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ impl<'a> NonLeafNodeBuilder<'a> {
|
|||||||
|
|
||||||
/// Matches a sting literal.
|
/// Matches a sting literal.
|
||||||
#[expect(dead_code)] // todo: remove (so far no commands requiring this are implemented)
|
#[expect(dead_code)] // todo: remove (so far no commands requiring this are implemented)
|
||||||
pub fn literal(string: &str) -> NonLeafNodeBuilder {
|
pub const fn literal(string: &str) -> NonLeafNodeBuilder {
|
||||||
NonLeafNodeBuilder {
|
NonLeafNodeBuilder {
|
||||||
node_type: NodeType::Literal { string },
|
node_type: NodeType::Literal { string },
|
||||||
child_nodes: Vec::new(),
|
child_nodes: Vec::new(),
|
||||||
|
|||||||
@ -146,7 +146,7 @@ impl Entity {
|
|||||||
// This has some vanilla magic
|
// This has some vanilla magic
|
||||||
let mut x = x;
|
let mut x = x;
|
||||||
let mut z = z;
|
let mut z = z;
|
||||||
while x * x + z * z < 1.0E-5 {
|
while x.mul_add(x, z * z) < 1.0E-5 {
|
||||||
x = (rand::random::<f64>() - rand::random::<f64>()) * 0.01;
|
x = (rand::random::<f64>() - rand::random::<f64>()) * 0.01;
|
||||||
z = (rand::random::<f64>() - rand::random::<f64>()) * 0.01;
|
z = (rand::random::<f64>() - rand::random::<f64>()) * 0.01;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -96,9 +96,8 @@ impl Player {
|
|||||||
entity_id: EntityId,
|
entity_id: EntityId,
|
||||||
gamemode: GameMode,
|
gamemode: GameMode,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let gameprofile = match client.gameprofile.lock().clone() {
|
let gameprofile = client.gameprofile.lock().clone().map_or_else(
|
||||||
Some(profile) => profile,
|
|| {
|
||||||
None => {
|
|
||||||
log::error!("No gameprofile?. Impossible");
|
log::error!("No gameprofile?. Impossible");
|
||||||
GameProfile {
|
GameProfile {
|
||||||
id: uuid::Uuid::new_v4(),
|
id: uuid::Uuid::new_v4(),
|
||||||
@ -106,8 +105,9 @@ impl Player {
|
|||||||
properties: vec![],
|
properties: vec![],
|
||||||
profile_actions: None,
|
profile_actions: None,
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
};
|
|profile| profile,
|
||||||
|
);
|
||||||
let config = client.config.lock().clone().unwrap_or_default();
|
let config = client.config.lock().clone().unwrap_or_default();
|
||||||
Self {
|
Self {
|
||||||
entity: Entity::new(entity_id, world, EntityType::Player, 1.62),
|
entity: Entity::new(entity_id, world, EntityType::Player, 1.62),
|
||||||
@ -135,7 +135,7 @@ impl Player {
|
|||||||
self.entity.world.remove_player(self);
|
self.entity.world.remove_player(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn entity_id(&self) -> EntityId {
|
pub const fn entity_id(&self) -> EntityId {
|
||||||
self.entity.entity_id
|
self.entity.entity_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,16 @@
|
|||||||
|
#![deny(clippy::all)]
|
||||||
|
// #![warn(clippy::pedantic)]
|
||||||
|
// #![warn(clippy::restriction)]
|
||||||
|
#![warn(clippy::nursery)]
|
||||||
|
#![warn(clippy::cargo)]
|
||||||
|
// expect
|
||||||
|
#![expect(clippy::cargo_common_metadata)]
|
||||||
|
#![expect(clippy::multiple_crate_versions)]
|
||||||
|
#![expect(clippy::while_float)]
|
||||||
|
#![expect(clippy::significant_drop_in_scrutinee)]
|
||||||
|
#![expect(clippy::significant_drop_tightening)]
|
||||||
|
#![expect(clippy::future_not_send)]
|
||||||
|
#![expect(clippy::single_call_fn)]
|
||||||
#![expect(clippy::await_holding_lock)]
|
#![expect(clippy::await_holding_lock)]
|
||||||
|
|
||||||
#[cfg(target_os = "wasi")]
|
#[cfg(target_os = "wasi")]
|
||||||
|
|||||||
@ -28,7 +28,7 @@ pub enum RCONError {
|
|||||||
|
|
||||||
const SERVER: Token = Token(0);
|
const SERVER: Token = Token(0);
|
||||||
|
|
||||||
pub struct RCONServer {}
|
pub struct RCONServer;
|
||||||
|
|
||||||
impl RCONServer {
|
impl RCONServer {
|
||||||
pub async fn new(config: &RCONConfig, server: Arc<Server>) -> Result<Self, io::Error> {
|
pub async fn new(config: &RCONConfig, server: Arc<Server>) -> Result<Self, io::Error> {
|
||||||
@ -122,7 +122,7 @@ pub struct RCONClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl RCONClient {
|
impl RCONClient {
|
||||||
pub fn new(connection: TcpStream) -> Self {
|
pub const fn new(connection: TcpStream) -> Self {
|
||||||
Self {
|
Self {
|
||||||
connection,
|
connection,
|
||||||
logged_in: false,
|
logged_in: false,
|
||||||
|
|||||||
@ -8,7 +8,7 @@ use thiserror::Error;
|
|||||||
use tokio::io::AsyncReadExt;
|
use tokio::io::AsyncReadExt;
|
||||||
|
|
||||||
/// Client -> Server
|
/// Client -> Server
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
pub enum ServerboundPacket {
|
pub enum ServerboundPacket {
|
||||||
/// Typically, the first packet sent by the client, which is used to authenticate the connection with the server.
|
/// Typically, the first packet sent by the client, which is used to authenticate the connection with the server.
|
||||||
@ -19,7 +19,7 @@ pub enum ServerboundPacket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl ServerboundPacket {
|
impl ServerboundPacket {
|
||||||
pub fn from_i32(n: i32) -> Self {
|
pub const fn from_i32(n: i32) -> Self {
|
||||||
match n {
|
match n {
|
||||||
3 => Self::Auth,
|
3 => Self::Auth,
|
||||||
2 => Self::ExecCommand,
|
2 => Self::ExecCommand,
|
||||||
@ -28,7 +28,7 @@ impl ServerboundPacket {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
|
||||||
#[repr(i32)]
|
#[repr(i32)]
|
||||||
/// Server -> Client
|
/// Server -> Client
|
||||||
pub enum ClientboundPacket {
|
pub enum ClientboundPacket {
|
||||||
@ -76,7 +76,7 @@ pub struct Packet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Packet {
|
impl Packet {
|
||||||
pub async fn deserialize(incoming: &mut Vec<u8>) -> Result<Option<Packet>, PacketError> {
|
pub async fn deserialize(incoming: &mut Vec<u8>) -> Result<Option<Self>, PacketError> {
|
||||||
if incoming.len() < 4 {
|
if incoming.len() < 4 {
|
||||||
return Ok(None);
|
return Ok(None);
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ impl Packet {
|
|||||||
}
|
}
|
||||||
incoming.drain(0..len as usize);
|
incoming.drain(0..len as usize);
|
||||||
|
|
||||||
let packet = Packet {
|
let packet = Self {
|
||||||
id,
|
id,
|
||||||
ptype: ServerboundPacket::from_i32(ty),
|
ptype: ServerboundPacket::from_i32(ty),
|
||||||
body: String::from_utf8(payload).map_err(PacketError::InvalidBody)?,
|
body: String::from_utf8(payload).map_err(PacketError::InvalidBody)?,
|
||||||
@ -110,11 +110,11 @@ impl Packet {
|
|||||||
&self.body
|
&self.body
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_type(&self) -> ServerboundPacket {
|
pub const fn get_type(&self) -> ServerboundPacket {
|
||||||
self.ptype
|
self.ptype
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_id(&self) -> i32 {
|
pub const fn get_id(&self) -> i32 {
|
||||||
self.id
|
self.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,9 +22,9 @@ pub struct CachedBranding {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl CachedBranding {
|
impl CachedBranding {
|
||||||
pub fn new() -> CachedBranding {
|
pub fn new() -> Self {
|
||||||
let cached_server_brand = Self::build_brand();
|
let cached_server_brand = Self::build_brand();
|
||||||
CachedBranding {
|
Self {
|
||||||
cached_server_brand,
|
cached_server_brand,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ impl CachedStatus {
|
|||||||
let status_response_json = serde_json::to_string(&status_response)
|
let status_response_json = serde_json::to_string(&status_response)
|
||||||
.expect("Failed to parse Status response into JSON");
|
.expect("Failed to parse Status response into JSON");
|
||||||
|
|
||||||
CachedStatus {
|
Self {
|
||||||
_status_response: status_response,
|
_status_response: status_response,
|
||||||
status_response_json,
|
status_response_json,
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,7 +22,7 @@ impl KeyStore {
|
|||||||
&private_key.e().to_bytes_be(),
|
&private_key.e().to_bytes_be(),
|
||||||
)
|
)
|
||||||
.into_boxed_slice();
|
.into_boxed_slice();
|
||||||
KeyStore {
|
Self {
|
||||||
_public_key: public_key,
|
_public_key: public_key,
|
||||||
private_key,
|
private_key,
|
||||||
public_key_der,
|
public_key_der,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user