Style fixes

This commit is contained in:
QuantumEntangledAndy committed 2024-10-26 14:33:19 +07:00
1 parent 4f8fb6c7b5
commit ed4a5ea001
9 files changed
+13 -57

No files matched your search

Generated
+3 -22
View File
@@ -1,6 +1,6 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
version = 4
[[package]]
name = "addr2line"
@@ -839,25 +839,6 @@ dependencies = [
"webpki-roots",
]
[[package]]
name = "fcm-push-listener"
version = "3.0.0"
dependencies = [
"base64 0.21.7",
"ece",
"log",
"prost",
"prost-build",
"rand",
"reqwest",
"serde",
"serde_with",
"tokio",
"tokio-rustls 0.23.4",
"uuid",
"webpki-roots",
]
[[package]]
name = "fixedbitset"
version = "0.4.2"
@@ -1895,7 +1876,7 @@ dependencies = [
"crossbeam-channel",
"dirs",
"env_logger 0.11.3",
"fcm-push-listener 2.0.3",
"fcm-push-listener",
"futures",
"gstreamer",
"gstreamer-app",
@@ -2339,7 +2320,7 @@ dependencies = [
"anyhow",
"clap",
"env_logger 0.10.2",
"fcm-push-listener 2.0.3",
"fcm-push-listener",
"lazy_static",
"log",
"neolink_core",
+2 -4
View File
@@ -90,10 +90,8 @@ fn bc_modern_msg<'a>(
E::add_context(input, ctx, E::from_error_kind(input, kind))
}
let ext_len = match header.payload_offset {
Some(off) => off,
_ => 0, // If missing payload_offset treat all as payload
};
// If missing payload_offset treat all as payload
let ext_len = header.payload_offset.unwrap_or_default();
let (buf, ext_buf) = take(ext_len)(buf)?;
let payload_len = header.body_len - ext_len;
+3 -8
View File
@@ -192,8 +192,11 @@ pub struct BcMeta {
pub stream_type: u8,
/// On modern messages this is the response code
/// When sending a command it is set to `0`. The reply from the camera can be
///
/// - `200` for OK
///
/// - `400` for bad request
///
/// A malformed packet will return a `400` code
pub response_code: u16,
/// A message ID is used to match replies with requests. The camera will parrot back
@@ -213,14 +216,6 @@ pub struct BcMeta {
pub class: u16,
}
/// The components of the Baichuan header that must be filled out after the body is serialized, or
/// is needed for the deserialization of the body (strictly part of the wire format of the message)
#[derive(Debug, PartialEq, Eq)]
pub(super) struct BcSendInfo {
pub body_len: u32,
pub payload_offset: Option<u32>,
}
#[derive(Debug)]
pub(crate) struct BcContext {
pub(crate) credentials: Credentials,
@@ -20,9 +20,9 @@ pub struct BcStream<'a> {
rx: &'a mut ReceiverStream<Result<Bc>>,
}
impl<'a> Unpin for BcStream<'a> {}
impl Unpin for BcStream<'_> {}
impl<'a> Stream for BcStream<'a> {
impl Stream for BcStream<'_> {
type Item = Result<Bc>;
fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Result<Bc>>> {
+1 -1
View File
@@ -214,7 +214,7 @@ impl ToSocketAddrsOrUid for SocketAddrV6 {
}
}
impl<'a> ToSocketAddrsOrUid for &'a [SocketAddr] {
impl ToSocketAddrsOrUid for &'_ [SocketAddr] {
type UidIter = std::vec::IntoIter<SocketAddrOrUid>;
fn to_socket_addrs_or_uid(&self) -> Result<Self::UidIter, Error> {
-9
View File
@@ -34,15 +34,6 @@ impl Decoder for BcUdpCodex {
type Item = BcUdp;
type Error = Error;
/// Since frames can cross EOF boundaries we overload this so it doesn't error if
/// there are bytes left on the stream
// fn decode_eof(&mut self, buf: &mut BytesMut) -> Result<Option<Self::Item>> {
// match self.decode(buf)? {
// Some(frame) => Ok(Some(frame)),
// None => Ok(None),
// }
// }
fn decode(&mut self, src: &mut BytesMut) -> Result<Option<Self::Item>> {
log::trace!("Decoding:");
if src.is_empty() {
-8
View File
@@ -53,14 +53,6 @@ async fn main() -> Result<()> {
Ok(())
}
fn get_local_ip() -> Result<std::net::IpAddr> {
get_if_addrs::get_if_addrs()?
.iter()
.find(|i| !i.is_loopback() && matches!(i.addr, get_if_addrs::IfAddr::V4(_)))
.map(|iface| Ok(iface.ip()))
.unwrap_or_else(|| Err(anyhow!("No Local Ip Address Found")))
}
async fn cam_tasks(name: &str, camera: BcCamera, addr: SocketAddr) -> Result<()> {
let support = camera.get_support().await?;
if support.email.is_some_and(|v| v > 0) {
+1 -2
View File
@@ -26,7 +26,6 @@ use neolink_core::{
bc_protocol::{BcCamera, StreamKind},
bcmedia::model::BcMedia,
};
#[cfg(feature = "gstreamer")]
/// This instance is the primary interface used throughout the app
///
@@ -423,7 +422,7 @@ impl NeoInstance {
}),
));
#[cfg(pushnoti)]
#[cfg(feature = "pushnoti")]
{
// Creates a permit for controlling based on the PN
let pn_permit = counter.create_deactivated().await?;
+1 -1
View File
@@ -339,7 +339,7 @@ impl<'a> MqttBackend<'a> {
}
}
impl<'a> Drop for MqttBackend<'a> {
impl Drop for MqttBackend<'_> {
fn drop(&mut self) {
self.cancel.cancel();
}