Skip to content

Commit

Permalink
refactor: Organize code structure by separating concerns into distinc…
Browse files Browse the repository at this point in the history
…t modules and defining clear boundaries between StateMachine, ConstructableService, WalletApi, and related types
  • Loading branch information
S0c5 committed Mar 25, 2024
1 parent 21cb979 commit 35c262c
Show file tree
Hide file tree
Showing 20 changed files with 363 additions and 216 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
target/
Cargo.lock
.vscode/
**/*.rs.bk
**/*.rs.bk
.Ds_Store
23 changes: 23 additions & 0 deletions core/examples/hello-world.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// use async_std::main;
// use serde::{Deserialize, Serialize};
// use virto_sdk::StateMachine;

// #[derive(VApp)]
// #[vapp(
// name = "Hello-world",
// description = "a simple app to count"
// version = "0.0.1",
// )]
// struct HelloWorld {
// count: i32
// }

// #[vctrl]
// impl HelloWorld {
// pub fn sum(&mut self, units: i32) {
// self.count += 1;
// }
// }
fn main() {
()
}
24 changes: 11 additions & 13 deletions core/src/backend/matrix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,16 @@ mod types;
pub use registry::*;

pub mod prelude {
pub use super::types::*;
pub use matrix_sdk::{
ruma::{
api::client::room::{create_room::v3::Request as CreateRoomRequest, Visibility},
events::{
macros::EventContent, room::encryption::RoomEncryptionEventContent, InitialStateEvent,
pub use super::types::*;
pub use matrix_sdk::{
ruma::{
api::client::room::{create_room::v3::Request as CreateRoomRequest, Visibility},
events::{
macros::EventContent, room::encryption::RoomEncryptionEventContent,
InitialStateEvent,
},
serde::Raw,
},
serde::Raw,
},
Client, Room,
};


Client, Room,
};
}

5 changes: 3 additions & 2 deletions core/src/backend/matrix/registry.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use crate::base::{AppInfo, AppRegistryError, Registry, RegistryResult, RegistryState, AppMetadata };
use crate::base::{
AppInfo, AppMetadata, AppRegistryError, Registry, RegistryResult, RegistryState,
};

use super::prelude::*;
use crate::utils::prelude::*;
Expand Down Expand Up @@ -80,7 +82,6 @@ impl MatrixRegistry {
}
}


impl Registry for MatrixRegistry {
async fn add(&self, info: &AppInfo) -> RegistryResult<RegistryState> {
if self.is_registered(info).await? {
Expand Down
4 changes: 2 additions & 2 deletions core/src/backend/matrix/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::utils::prelude::*;
use crate::base::RegistryState;
use super::prelude::*;
use crate::base::RegistryState;
use crate::utils::prelude::*;

#[derive(Serialize, Clone, Debug, Default, Deserialize, EventContent)]
#[ruma_event(type = "m.virto.apps", kind = GlobalAccountData)]
Expand Down
Loading

0 comments on commit 35c262c

Please sign in to comment.