Rust framework 🐦 'Experimental

Table of contents

Services

Create service instance (Singleton) in one step

```rust use wildbird::derive::*;

// Convert struct to Service + impl construct()

[service(construct = "init")]

struct HelloService { component_name: String, }

impl HelloService { fn init() -> HelloService { HelloService { componentname: "Hello penguins 🐧".tostring(), } }

fn sey_hello(&self) {
    println!("Hello! 👋")
}

}

fn main() { HelloService.sey_hello(); } ```


```rust use wildbird::derive::*;

// Convert struct to Service

[service]

struct HelloService { component_name: String, }

// Impl Service trait construct()

[service(construct)]

fn helloinit() -> HelloService { HelloService { componentname: "Hello 🚀".to_string(), } } ```

Globals

Create global variable

```rust use wildbird::derive::*;

[var]

pub fn my_name() -> String { String::from("Hawk 🦅") }

fn main() { println!("Hello from 🇵🇱, {}", MY_NAME); } ```


```rust use wildbird::derive::*;

[var(name = "HOME")]

fn custom_name() -> String { std::env::var("HOME").expect("env:HOME not found") }

fn main() { println!("Home: {}", HOME); } ```

Created By


License

MIT


BACK TO TOP ⬆️