Update
This commit is contained in:
parent
515b5f946b
commit
e8038e2cec
6 changed files with 48 additions and 10 deletions
18
Cargo.lock
generated
18
Cargo.lock
generated
|
@ -2,6 +2,15 @@
|
|||
# It is not intended for manual editing.
|
||||
version = 4
|
||||
|
||||
[[package]]
|
||||
name = "aiproxy"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"dbus",
|
||||
"dbus-codegen",
|
||||
"dbus-tree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "anstream"
|
||||
version = "0.6.18"
|
||||
|
@ -96,15 +105,6 @@ dependencies = [
|
|||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dbus-ai"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"dbus",
|
||||
"dbus-codegen",
|
||||
"dbus-tree",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "dbus-codegen"
|
||||
version = "0.12.0"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "dbus-ai"
|
||||
name = "aiproxy"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
authors = ["Florian RICHER <florian.richer@protonmail.com>"]
|
||||
|
@ -11,5 +11,10 @@ dbus = "0.9"
|
|||
dbus-codegen = "0.12"
|
||||
dbus-tree = "0.9"
|
||||
|
||||
[workspace.dependencies]
|
||||
thiserror = "2.0"
|
||||
|
||||
aiproxy-providers = { path = "crates/aiproxy-providers" }
|
||||
|
||||
[build-dependencies]
|
||||
dbus-codegen = "0.12"
|
7
crates/aiproxy-providers/Cargo.toml
Normal file
7
crates/aiproxy-providers/Cargo.toml
Normal file
|
@ -0,0 +1,7 @@
|
|||
[package]
|
||||
name = "aiproxy-providers"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
thiserror = { workspace = true }
|
1
crates/aiproxy-providers/src/lib.rs
Normal file
1
crates/aiproxy-providers/src/lib.rs
Normal file
|
@ -0,0 +1 @@
|
|||
mod provider;
|
25
crates/aiproxy-providers/src/provider.rs
Normal file
25
crates/aiproxy-providers/src/provider.rs
Normal file
|
@ -0,0 +1,25 @@
|
|||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ProviderBuildError {
|
||||
#[error("Internal error: {0}")]
|
||||
InternalError(String),
|
||||
}
|
||||
|
||||
pub trait Provider {
|
||||
|
||||
}
|
||||
|
||||
pub struct ProviderBuilder {
|
||||
base_url: String,
|
||||
api_key: Option<String>
|
||||
}
|
||||
|
||||
impl ProviderBuilder {
|
||||
pub fn build<T>(self) -> Result<Box<T>, ProviderBuildError>
|
||||
where
|
||||
T: Provider + TryFrom<ProviderBuilder, Error = ProviderBuildError>,
|
||||
{
|
||||
Ok(Box::new(T::try_from(self)?))
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue