vine

Crates.iovine
lib.rsvine
version
sourcesrc
created_at2024-08-02 07:25:01.464361+00
updated_at2025-04-11 12:24:32.418333+00
descriptionVine is rust framework inspired by Spring Boot
homepage
repository
max_upload_size
id1322897
Cargo.toml error:TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include`
size0
(zammr)

documentation

README

Vine

Vine is rust framework inspired by Spring Boot

Example:

use std::sync::Arc;
use async_trait::async_trait;
use axum::extract::Path;
use axum::response::IntoResponse;
use vine::{Bean, controller, get, injectable};
use vine::vine_core::core::Error;

#[async_trait]
trait Service {
    async fn compute(&self, name: String) -> String;
}

#[derive(Bean)]
struct Controller {
    service: Arc<dyn Service + Sync + Send>,
}

#[controller]
impl Controller {
    #[get("/hello/:name")]
    async fn say_hello(&self, Path(name): Path<String>) -> impl IntoResponse {
        self.service.compute(name).await
    }
}

#[derive(Bean)]
struct ServiceImpl {
    #[value("${service.name:DefaultName}")] name: String,
}

#[async_trait]
#[injectable]
impl Service for ServiceImpl {
    async fn compute(&self, name: String) -> String {
        format!("Hello from the {}: {}", &self.name, name)
    }
}

#[tokio::main]
async fn main() -> Result<(), Error> {
    vine::create_app()?
        .exec().await
}
Commit count: 0

cargo fmt