Skip to content

Commit

Permalink
WIP: update to tauri 2.0.0-alpha
Browse files Browse the repository at this point in the history
  • Loading branch information
KarlK90 authored and Stefan Kerkmann committed Feb 15, 2023
1 parent 9edc43b commit c7ce2fb
Show file tree
Hide file tree
Showing 8 changed files with 387 additions and 473 deletions.
806 changes: 360 additions & 446 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ authors = ["you"]
license = ""
repository = ""
edition = "2021"
rust-version = "1.65"
rust-version = "1.67"

[build-dependencies]
tauri-build = { version = "1.2.1", features = [] }
tauri-build = { version = "2.0.0-alpha.1", features = [] }
ts-rs = { git = "https://github.com/Aleph-Alpha/ts-rs", branch = "main", features = [
"serde-compat",
"uuid-impl",
] }

[dependencies]
anyhow = "1.0"
binrw = "0.10"
binrw = "0.11.1"
bitflags = "1.3"
flate2 = "1.0"
crossbeam-channel = "0.5"
Expand All @@ -30,7 +30,7 @@ serde = { version = "1", features = ["derive"] }
serde_json = "1"
deser-hjson = "1"
serde_with = "2"
tauri = { version = "1.2", features = ["api-all"] }
tauri = { version = "2.0.0-alpha.3", features = ["api-all"] }
thiserror = "1.0"
ts-rs = { git = "https://github.com/Aleph-Alpha/ts-rs", branch = "main", features = [
"serde-compat",
Expand Down
2 changes: 1 addition & 1 deletion xap-specs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ edition = "2021"

[dependencies]
anyhow = "1.0"
binrw = "0.10"
binrw = "0.11.1"
bitflags = "1.3"
flate2 = "1.0"
log = "0.4"
Expand Down
10 changes: 5 additions & 5 deletions xap-specs/src/protocol/broadcast.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::fmt::Debug;
use std::io::Cursor;

use binrw::{binread, BinRead, BinReaderExt};
use binrw::{binread, BinRead, BinReaderExt, Endian};
use log::trace;

use crate::error::XAPResult;
Expand Down Expand Up @@ -51,18 +51,18 @@ impl BroadcastRaw {
}
}

pub trait XAPBroadcast: Sized + Debug + BinRead<Args = ()> {}
pub trait XAPBroadcast: Sized + Debug + for<'a> BinRead<Args<'a> = ()> {}

#[derive(Debug)]
pub struct LogBroadcast(pub String);

impl BinRead for LogBroadcast {
type Args = ();
type Args<'a> = ();

fn read_options<R: std::io::Read + std::io::Seek>(
reader: &mut R,
_options: &binrw::ReadOptions,
_args: Self::Args,
_endian: Endian,
_args: Self::Args<'_>,
) -> binrw::BinResult<Self> {
let len: u8 = reader.read_le()?;
let mut bytes = Vec::with_capacity(len as usize);
Expand Down
6 changes: 3 additions & 3 deletions xap-specs/src/protocol/subsystems/xap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,12 @@ impl Default for XAPSecureStatus {
}

impl BinRead for XAPSecureStatus {
type Args = ();
type Args<'a> = ();

fn read_options<R: std::io::Read + std::io::Seek>(
reader: &mut R,
_options: &ReadOptions,
_args: Self::Args,
_endian: Endian,
_args: Self::Args<'_>,
) -> BinResult<Self> {
let raw_status: u8 = reader.read_le()?;
Ok(match raw_status {
Expand Down
12 changes: 6 additions & 6 deletions xap-specs/src/request.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use core::fmt::Debug;
use std::io::{Seek, Write};

use binrw::{BinRead, BinResult, BinWrite, BinWriterExt};
use binrw::{BinRead, BinResult, BinWrite, BinWriterExt, Endian};

use crate::token::Token;

pub trait XAPRequest: Sized + Debug + BinWrite<Args = ()> {
type Response: BinRead<Args = ()>;
pub trait XAPRequest: Sized + Debug + for<'a> BinWrite<Args<'a> = ()> {
type Response: for<'a> BinRead<Args<'a> = ()>;

fn id() -> &'static [u8];

Expand Down Expand Up @@ -40,13 +40,13 @@ impl<T> BinWrite for RawRequest<T>
where
T: XAPRequest,
{
type Args = ();
type Args<'a> = ();

fn write_options<W: Write + Seek>(
&self,
writer: &mut W,
_options: &binrw::WriteOptions,
_args: Self::Args,
_endian: Endian,
_args: Self::Args<'_>,
) -> BinResult<()> {
writer.write_le(&self.token)?;
// Dummy write of the payload length, which is not known at this point.
Expand Down
8 changes: 4 additions & 4 deletions xap-specs/src/response.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use core::fmt::Debug;
use std::io::{Cursor, Read, Seek};

use binrw::{binread, BinRead, BinResult, ReadOptions};
use binrw::{binread, BinRead, BinResult, Endian};
use bitflags::bitflags;
use log::trace;

Expand Down Expand Up @@ -68,12 +68,12 @@ impl RawResponse {
pub struct UTF8StringResponse(pub String);

impl BinRead for UTF8StringResponse {
type Args = ();
type Args<'a> = ();

fn read_options<R: Read + Seek>(
reader: &mut R,
_options: &ReadOptions,
_args: Self::Args,
_endian: Endian,
_args: Self::Args<'_>,
) -> BinResult<Self> {
Ok(Self(std::io::read_to_string(reader)?))
}
Expand Down
8 changes: 4 additions & 4 deletions xap-specs/src/token.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file defines the different kind of tokens

use anyhow::anyhow;
use binrw::{prelude::*, ReadOptions};
use binrw::{prelude::*, Endian};
use rand::distributions::{Distribution, Uniform};

#[derive(Debug, Clone, PartialEq, Eq)]
Expand All @@ -22,12 +22,12 @@ impl Token {
}

impl BinRead for Token {
type Args = ();
type Args<'a> = ();

fn read_options<R: std::io::Read + std::io::Seek>(
reader: &mut R,
_options: &ReadOptions,
_args: Self::Args,
_endian: Endian,
_args: Self::Args<'_>,
) -> BinResult<Self> {
let raw: u16 = reader.read_le()?;

Expand Down

0 comments on commit c7ce2fb

Please sign in to comment.