Skip to content

Commit

Permalink
More derives
Browse files Browse the repository at this point in the history
  • Loading branch information
ljoonal committed Apr 17, 2023
1 parent e1a1efa commit 3558d69
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ async-trait = "0.1"
tokio = "1"

# Platform specifics
neos = { version = "0.6.3", features = [], default-features = false }
neos = { version = "0.6.4", features = [], default-features = false }
#neos = { path = "../neos_rs", features = [] }
chilloutvr = { version = "0.4.0", features = [] }
#chilloutvr = { path = "../chilloutvr_rs", features = [] }
Expand Down
1 change: 1 addition & 0 deletions onlivfe/src/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ crate::platform_enum_id!(PlatformAccountId, PlatformAccount {

crate::platform_enum!(
/// Details of a platform account friend
#[derive(Eq)]
PlatformFriend {
Box<vrc::model::Friend>,
Box<chilloutvr::model::Friend>,
Expand Down
7 changes: 5 additions & 2 deletions onlivfe/src/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::PlatformAccountId;

/// An error that occurred with the login
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(tag = "error", content = "data")]
pub enum LoginError {
/// An error occurred
Expand All @@ -15,6 +15,7 @@ pub enum LoginError {

crate::platform_enum!(
/// Credentials for a platform
#[derive(Eq)]
Authentication {
Box<vrc::query::Authentication>,
Box<chilloutvr::query::SavedLoginCredentials>,
Expand All @@ -28,7 +29,9 @@ crate::platform_enum_id!(PlatformAccountId, Authentication {
} v);

// Can't use platform enum due to not knowing user IDs before auth has completed
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
#[derive(
Clone, Debug, PartialEq, Eq, Hash, serde::Serialize, serde::Deserialize,
)]
#[serde(tag = "platform", content = "data")]
/// Required for trying to create a platform authentication
pub enum LoginCredentials {
Expand Down
1 change: 1 addition & 0 deletions onlivfe/src/instances.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ crate::platform_id!(

crate::platform_enum!(
/// The platform specific instance/session.
#[derive(Eq)]
Instance {
vrc::model::Instance,
chilloutvr::model::ExtendedInstanceDetails,
Expand Down
6 changes: 3 additions & 3 deletions onlivfe/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ macro_rules! platform_enum {
($(#[$meta:meta])*
$name:ident { $vrc:ty, $cvr:ty, $neos:ty }) => {
$(#[$meta])*
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize)]
#[derive(Clone, Debug, PartialEq, serde::Serialize, serde::Deserialize)]
#[serde(tag = "platform", content = "data")]
pub enum $name {
/// VRChat variant
Expand Down Expand Up @@ -216,7 +216,7 @@ impl Profile {
}

/// Metadata about the data from a platform
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct PlatformDataMetadata<Id> {
/// When the data was fetched
Expand All @@ -226,7 +226,7 @@ pub struct PlatformDataMetadata<Id> {
}

/// Metadata about the data from a platform with the data
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct PlatformDataAndMetadata<T, Id> {
/// The actual data itself
pub data: T,
Expand Down
2 changes: 1 addition & 1 deletion onlivfe/src/vrchat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl From<super::PlatformDataMetadata<vrc::id::User>>
}

/// A VRC login request portion
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)]
pub enum LoginRequestPart {
/// Login with credentials
LoginRequest(vrc::query::Authenticating),
Expand Down

0 comments on commit 3558d69

Please sign in to comment.