Skip to content

dekirisu/querio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚧 WIP, but wanted a basic version up 🚧

Struct based string builder

🐠 add querio to the dependencies in the Cargo.toml:

[dependencies]
querio = "0.0.1"

🦀 use/import everything into rust:

use querio::*;

🦊 build the string:

// runtime variables
#[derive(Strung,Intuple)]
struct VarStruct {
    numb: u32,
    strg: &'static str
}

// create builder
#[derive(Querio)]
#[querio(
    // attach runtime variables, address with #{field_name}
    variables(VarStruct), 

    // add compile time variables, address with <index>
    sections("Test1","Test2"), 

    // the string those variables will be merged in
    "#numb #strg <0> <1> <0>"
)] struct ABuilder {}

fn main(){
    // use the builder with attached variables struct
    let text = ABuilder::querio(&VarStruct{numb:10,strg:"RT"}); 
    // => "10 RT Test1 Test2 Test1"
        
    // OR use the variable structs tuple representation and ::qrio(..)
    let text = ABuilder::qrio((10,"RT"));
    // => "10 RT Test1 Test2 Test1"
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

No description, website, or topics provided.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages