mirror of
https://github.com/logos-messaging/libchat.git
synced 2026-03-26 22:23:14 +00:00
Flatten Repos (#70)
* move to “crates” style folder * Update workspace * clear crate names * Rename crate folders based on feedback * Use workspace dependencies instead of paths * Move updated files from core
This commit is contained in:
parent
daeecbd679
commit
9a94f9a6d6
7
Cargo.lock
generated
7
Cargo.lock
generated
@ -119,6 +119,13 @@ dependencies = [
|
|||||||
"zeroize",
|
"zeroize",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "client"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"libchat",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "const-oid"
|
name = "const-oid"
|
||||||
version = "0.9.6"
|
version = "0.9.6"
|
||||||
|
|||||||
12
Cargo.toml
12
Cargo.toml
@ -3,15 +3,17 @@
|
|||||||
resolver = "3"
|
resolver = "3"
|
||||||
|
|
||||||
members = [
|
members = [
|
||||||
"conversations",
|
"core/conversations",
|
||||||
"crypto",
|
"core/crypto",
|
||||||
"double-ratchets",
|
"core/double-ratchets",
|
||||||
"storage",
|
"core/storage",
|
||||||
|
"crates/client",
|
||||||
]
|
]
|
||||||
|
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
blake2 = "0.10"
|
blake2 = "0.10"
|
||||||
storage = { path = "storage" }
|
libchat = { path = "core/conversations" }
|
||||||
|
storage = { path = "core/storage" }
|
||||||
|
|
||||||
# Panicking across FFI boundaries is UB; abort is the correct strategy for a
|
# Panicking across FFI boundaries is UB; abort is the correct strategy for a
|
||||||
# C FFI library.
|
# C FFI library.
|
||||||
|
|||||||
7
core/README.md
Normal file
7
core/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# Core
|
||||||
|
|
||||||
|
Crates in this directory will one day be separated into a separate shared repository.
|
||||||
|
|
||||||
|
They could be moved now, but it's desirable to have a monorepo setup at this time.
|
||||||
|
|
||||||
|
These crates MUST not depend on any code outside of this folder.
|
||||||
@ -12,6 +12,8 @@ mod types;
|
|||||||
mod utils;
|
mod utils;
|
||||||
|
|
||||||
pub use api::*;
|
pub use api::*;
|
||||||
|
pub use context::{Context, Introduction};
|
||||||
|
pub use errors::ChatError;
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
10
crates/client/Cargo.toml
Normal file
10
crates/client/Cargo.toml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[package]
|
||||||
|
name = "client"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2024"
|
||||||
|
|
||||||
|
[lib]
|
||||||
|
crate-type = ["rlib"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
libchat = { workspace = true }
|
||||||
18
crates/client/src/client.rs
Normal file
18
crates/client/src/client.rs
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
use libchat::ChatError;
|
||||||
|
use libchat::Context;
|
||||||
|
|
||||||
|
pub struct ChatClient {
|
||||||
|
ctx: Context,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ChatClient {
|
||||||
|
pub fn new(name: impl Into<String>) -> Self {
|
||||||
|
Self {
|
||||||
|
ctx: Context::new_with_name(name),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn create_bundle(&mut self) -> Result<Vec<u8>, ChatError> {
|
||||||
|
self.ctx.create_intro_bundle()
|
||||||
|
}
|
||||||
|
}
|
||||||
3
crates/client/src/lib.rs
Normal file
3
crates/client/src/lib.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
mod client;
|
||||||
|
|
||||||
|
pub use client::ChatClient;
|
||||||
Loading…
x
Reference in New Issue
Block a user