Improve and strengthen your strings by making them strongly-typed with less boilerplate

Overview

aliri_braid

Build Status

Improve and strengthen your strings

Strongly-typed APIs reduce errors and confusion over passing around un-typed strings. Braid helps in that endeavor by making it painless to create wrappers around your string values, ensuring that you use them in the right way every time.

Usage

A braid is created by attaching #[braid] to a struct definition. The macro will take care of automatically updating the representation of the struct to wrap a string and generate the borrowed form of the strong type.

use aliri_braid::braid;

#[braid]
pub struct DatabaseName;

Once created, braids can be passed around as strongly-typed strings.

#
fn take_strong_string(n: DatabaseName) {}
fn borrow_strong_string(n: &DatabaseNameRef) {}

#
let owned = DatabaseName::new("mongo");
borrow_strong_string(&owned);
take_strong_string(owned);

A braid can also be untyped for use in stringly-typed interfaces.

#
fn take_raw_string(s: String) {}
fn borrow_raw_str(s: &str) {}

#
let owned = DatabaseName::new("mongo");
borrow_raw_str(owned.as_str());
take_raw_string(owned.into_string());

By default, the name of the borrowed form will be the same as the owned form with Ref appended to the end.

#
#[braid]
pub struct DatabaseName;

let owned = DatabaseName::new("mongo");
let borrowed = DatabaseNameRef::from_str("mongo");

If the name ends with Buf, however, then the borrowed form will drop the Buf, similar to the relationship between [PathBuf][std::path::PathBuf] and [Path][std::path::Path].

#
#[braid]
pub struct DatabaseNameBuf;

let owned = DatabaseNameBuf::new("mongo");
let borrowed = DatabaseName::from_str("mongo");

If a different name is desired, this behavior can be overridden by specifying the name of the reference type to create using the ref parameter.

#
#[braid(ref = "TempDb")]
pub struct DatabaseNameBuf;

let owned = DatabaseNameBuf::new("mongo");
let borrowed = TempDb::from_str("mongo");
let to_owned: DatabaseNameBuf = borrowed.to_owned();

A default doc comment is added to the borrowed form that refers back to the owned form. If a custom doc comment is desired, the ref_doc parameter allows supplying custom documentation.

#
#[braid(ref_doc = "A temporary reference to a database name")]
pub struct DatabaseName;
#

Extensibility

The types created by the braid macro are placed in the same module where declared. This means additional functionality, including mutations, can be implemented easily.

As a basic example, here is a type built to hold Amazon ARNs. The type has been extended to support some mutation and introspection.

std::str::Split { self.0.split(':') } /// Returns the service segment of the ARN pub fn get_service(&self) -> &str { self.get_segments().nth(2).unwrap_or("") } } ">
#
#[braid]
pub struct AmazonArnBuf;

impl AmazonArnBuf {
    /// Append an ARN segment
    pub fn add_segment(&mut self, segment: &str) {
        self.0.push_str(":");
        self.0.push_str(segment);
    }
}

impl AmazonArn {
    /// Returns an iterator of all ARN segments
    pub fn get_segments(&self) -> std::str::Split<char> {
        self.0.split(':')
    }

    /// Returns the service segment of the ARN
    pub fn get_service(&self) -> &str {
        self.get_segments().nth(2).unwrap_or("")
    }
}

Encapsulation

Because code within the same module where the braid is defined are allowed to access the internal value, you can use a module in order to more strictly enforce encapsulation and limit accessibility that might otherwise violate established invariants. This may be particularly desired when the wrapped type requires validation.

mod amazon_arn {
    #[aliri_braid::braid]
    pub struct AmazonArnBuf;

    /* Additional impls that need access to the inner values */
#
}

pub use amazon_arn::{AmazonArnBuf, AmazonArn};

let x = AmazonArnBuf::new("arn:aws:iam::123456789012:user/Development");
assert_eq!("iam", x.get_service());

Soundness

This crate ensures that the from_str implementation provided for wrapping borrowed str slices does not extend lifetimes.

In the example below, we verify that the borrowed DatabaseNameRef is unable to escape the lifetime of data. The following code snippet will fail to compile, because data will go out of scope and be dropped at the end of the block creating ex_ref.

# use aliri_braid::braid;
#
# #[braid]
# pub struct DatabaseName;
#
let ex_ref = {
    let data = DatabaseName::new("test string");
    DatabaseNameRef::from_str(data.as_str())
}; // `data` is dropped at this point

// Which means that `ex_ref` would be invalid if allowed.
println!("{}", ex_ref);

Validation

Types can be configured to only contain certain values. This can be used to strongly enforce domain type boundaries, thus making invalid values unrepresentable.

For example, if you wanted to have a username type that did not accept the root user, you have a few options:

  1. Pass the username around as a string, validate that it isn't root at known entry points.
  2. Create a username type and allow creation from a raw string, then validate it just after creation.
  3. Create a strong username type that requires the value to be validated prior to being creatable.

Braided strings give the strongest, third guarantee. The other two methods require constant vigilance to ensure that an unexpected root value doesn't sneak in through other backdoors.

By default, Rust's module system allows items within the same module to have access to each other's non-public members. If not handled properly, this can lead to unintentionally violating invariants. Thus, for the strongest guarantees, it is recommended to use the module system to further control access to the interior values held by the braided type as described in the section on encapsulation.

#
#[derive(Debug, PartialEq, Eq)]
pub struct InvalidUsername;
// Error implementation elided

#[braid(validator)]
pub struct NonRootUsername;

impl aliri_braid::Validator for NonRootUsername {
    type Error = InvalidUsername;
    fn validate(s: &str) -> Result<(), Self::Error> {
        if s.is_empty() || s.eq_ignore_ascii_case("root") {
            Err(InvalidUsername)
        } else {
            Ok(())
        }
    }
}

assert!(NonRootUsername::new("").is_err());
assert!(NonRootUsername::new("root").is_err());
assert!(NonRootUsername::new("nobody").is_ok());

assert!(NonRootUsernameRef::from_str("").is_err());
assert!(NonRootUsernameRef::from_str("root").is_err());
assert!(NonRootUsernameRef::from_str("nobody").is_ok());

Foreign validators can also be used by specifying the name of the type that implements the validation logic.

#
#
#[braid(validator = "UsernameValidator")]
pub struct NonRootUsername;

pub struct UsernameValidator;

impl aliri_braid::Validator for UsernameValidator {
    /* … */
}

assert!(NonRootUsername::new("").is_err());
assert!(NonRootUsername::new("root").is_err());
assert!(NonRootUsername::new("nobody").is_ok());

assert!(NonRootUsernameRef::from_str("").is_err());
assert!(NonRootUsernameRef::from_str("root").is_err());
assert!(NonRootUsernameRef::from_str("nobody").is_ok());

Normalization

Braided strings can also have enforced normalization, which is carried out at the creation boundary. In this case, the .from_str() function on the borrowed form will return a [Cow][std::borrow::Cow], which can be inspected to determine whether normalization and conversion to an owned value was required. In cases where the incoming value is expected to already be normalized, the .from_normalized_str() function can be used. This function will return an error if the value required normalization.

When using serde to deserialze directly to the borrowed form, care must be taken, as only already normalized values will be able to be deserialized. If normalization is expected, deserialize into the owned form or Cow.

Here is a toy example where the value must not be empty and must be composed of ASCII characters, but that is also normalized to use lowercase ASCII letters.

use std::borrow::Cow;

#[derive(Debug, PartialEq, Eq)]
pub struct InvalidHeaderName;
// Error implementation elided

#[braid(normalizer)]
pub struct HeaderName;

impl aliri_braid::Normalizer for HeaderName {
    type Error = InvalidHeaderName;
    fn normalize(s: &str) -> Resultstr>, Self::Error> {
        if !s.is_ascii() || s.is_empty() {
            Err(InvalidHeaderName)
        } else if s.as_bytes().iter().any(|&b| b'A' <= b && b <= b'Z') {
            Ok(Cow::Owned(s.to_ascii_lowercase()))
        } else {
            Ok(Cow::Borrowed(s))
        }
    }
}

assert!(HeaderName::new("").is_err());
assert_eq!("mixedcase", HeaderName::new("MixedCase").unwrap().as_str());
assert_eq!("lowercase", HeaderName::new("lowercase").unwrap().as_str());

assert!(HeaderNameRef::from_str("").is_err());
assert_eq!("mixedcase", HeaderNameRef::from_str("MixedCase").unwrap().as_str());
assert_eq!("lowercase", HeaderNameRef::from_str("lowercase").unwrap().as_str());

assert!(HeaderNameRef::from_normalized_str("").is_err());
assert!(HeaderNameRef::from_normalized_str("MixedCase").is_err());
assert_eq!("lowercase", HeaderNameRef::from_normalized_str("lowercase").unwrap().as_str());

Unchecked creation

Where necessary for efficiency, it is possible to bypass the validations on creation through the use of the .new_unchecked() or from_str_unchecked() functions. These functions are marked as unsafe, as they require the caller to assert that they are fulfilling the implicit contract that the value be both valid and in normal form. If either of these constraints are violated, undefined behavior could result when downstream consumers depend on these constraints being upheld.

Result<(), Self::Error> { # if s.is_empty() || s.eq_ignore_ascii_case("root") { # Err(InvalidUsername) # } else { # Ok(()) # } # } # } # NonRootUsername::new_unchecked(""); NonRootUsernameRef::from_str_unchecked("nobody"); ">
# use aliri_braid::braid;
#
# #[derive(Debug, PartialEq, Eq)]
# pub struct InvalidUsername;
# // Error implementation elided
# impl std::fmt::Display for InvalidUsername {
#     fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
#         f.write_str("invalid username")
#     }
# }
# impl std::error::Error for InvalidUsername {}
#
# #[braid(validator)]
# pub struct NonRootUsername;
#
# impl aliri_braid::Validator for NonRootUsername {
#     type Error = InvalidUsername;
#     fn validate(s: &str) -> Result<(), Self::Error> {
#         if s.is_empty() || s.eq_ignore_ascii_case("root") {
#             Err(InvalidUsername)
#         } else {
#             Ok(())
#         }
#     }
# }
#
NonRootUsername::new_unchecked("");
NonRootUsernameRef::from_str_unchecked("nobody");

If you find violations of your guarantees, you can look specifically for uses of unsafe.

#
#
#
#
unsafe {
    NonRootUsername::new_unchecked("");
    NonRootUsernameRef::from_str_unchecked("root");
}

Provided trait impls

By default, the following traits will be automatically implemented.

For the Owned type

  • [std::clone::Clone]
  • [std::fmt::Debug]
  • [std::fmt::Display]
  • [std::hash::Hash]
  • [std::cmp::Eq]
  • [std::cmp::PartialEq]
  • [std::cmp::PartialEq]
  • [std::cmp::PartialEq<&Borrowed>]
  • [std::cmp::PartialEq>]
  • [std::convert::AsRef]
  • [std::convert::From<&Borrowed>]
  • [std::convert::From>]
  • [std::convert::From>]
  • [std::borrow::Borrow]
  • [std::str::FromStr]
  • [std::ops::Deref] where Target = Borrowed

Additionally, unvalidated owned types implement

  • [std::convert::From]
  • [std::convert::From<&str>]

Validated and normalized owned types will instead implement

  • [std::convert::TryFrom]
  • [std::convert::TryFrom<&str>]

When normalized, the above conversions will normalize values.

For the Borrowed type

  • [std::fmt::Debug]
  • [std::fmt::Display]
  • [std::hash::Hash]
  • [std::cmp::Eq]
  • [std::cmp::PartialEq]
  • [std::cmp::PartialEq]
  • [std::cmp::PartialEq<&Borrowed>]
  • [std::cmp::PartialEq>]
  • [std::borrow::ToOwned] where Owned = Owned

Additionally, unvalidated borrowed types implement

  • [std::convert::From<&str>]

Validated and normalize borrowed types will instead implement

  • [std::convert::TryFrom<&str>]

For Cow

  • [std::convert::From<&Borrowed>]

For Box

  • [std::convert::From]

The above conversion will fail if the value is not already normalized.

Deref to a str is explicitly not implemented. This means that an explicit call is required to treat a value as an untyped string, whether .as_str(), .to_string(), or .into_string()

Omitting Clone

For some types, it may be desirable to prevent arbitrary cloning of a type. In that case, the omit_clone parameter can be used to prevent automatically deriving [Clone][std::clone::Clone].

#
#[braid(omit_clone)]
pub struct Sensitive;

assert_not_impl_any!(Sensitive: Clone);

Custom Display and Debug

By default, the implementations of [Display][std::fmt::Display] and [Debug][std::fmt::Debug] provided by a braid delegate directly to the underlying [String] or [str] types. If a custom implementation is desired, the automatic derivation of these traits can be controlled by the display_impl and debug_impl parameters. Both of these parameters accept one of auto, owned, or none. By default, the auto derivation mode is used.

The modes have the following effects:

  • auto: Format the owned and reference type transparently as the underlying string (slice) type.
  • owned: Automatically provide an owned implementation that transparently delegates to the implementation of the borrowed form. The consumer must provide their custom implementation on the borrowed form.
  • none: No implementations are provided for the owned or borrowed forms. These must be implemented by the consumer if they are desired.

As an example:

fmt::Result { f.write_str("SENSITIVE") } } impl fmt::Display for SensitiveRef { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("SENSITIVE DISPLAY") } } let owned = Sensitive::new("secret value"); assert_eq!("SENSITIVE", format!("{:?}", owned)); assert_eq!("SENSITIVE DISPLAY", format!("{}", owned)); assert_eq!("secret value", owned.as_str()); let borrowed: &SensitiveRef = &owned; assert_eq!("SENSITIVE", format!("{:?}", borrowed)); assert_eq!("SENSITIVE DISPLAY", format!("{}", borrowed)); assert_eq!("secret value", borrowed.as_str()); ">
use std::fmt;
#
#[braid(omit_clone, display_impl = "owned", debug_impl = "owned")]
pub struct Sensitive;

impl fmt::Debug for SensitiveRef {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.write_str("SENSITIVE")
    }
}

impl fmt::Display for SensitiveRef {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
         f.write_str("SENSITIVE DISPLAY")
    }
}

let owned = Sensitive::new("secret value");
assert_eq!("SENSITIVE", format!("{:?}", owned));
assert_eq!("SENSITIVE DISPLAY", format!("{}", owned));
assert_eq!("secret value", owned.as_str());

let borrowed: &SensitiveRef = &owned;
assert_eq!("SENSITIVE", format!("{:?}", borrowed));
assert_eq!("SENSITIVE DISPLAY", format!("{}", borrowed));
assert_eq!("secret value", borrowed.as_str());

Serde

Serialize and Deserialize implementations from the serde crate can be automatically generated by including serde in the argument list for the macro.

#
#[braid(serde)]
pub struct Username;

let username = Username::new("root");
let json = serde_json::to_string(&username).unwrap();
let new_username: Username = serde_json::from_str(&json).unwrap();

Such automatic implementations will also properly handle string values that require validation. This automatic validation has the benefit of easing use with Serde while still protecting the integrity of the type.

("\"\"").is_err()); assert!(serde_json::from_str::("\"root\"").is_err()); assert!(serde_json::from_str::("\"nobody\"").is_ok()); assert!(serde_json::from_str::<&UsernameRef>("\"\"").is_err()); assert!(serde_json::from_str::<&UsernameRef>("\"root\"").is_err()); assert!(serde_json::from_str::<&UsernameRef>("\"nobody\"").is_ok()); ">
#
#[derive(Debug, PartialEq, Eq)]
pub struct InvalidUsername;
// Error implementation elided

#[braid(serde, validator)]
pub struct Username;

impl aliri_braid::Validator for Username {
    type Error = InvalidUsername;
    fn validate(s: &str) -> Result<(), Self::Error> {
        if s.is_empty() || s.eq_ignore_ascii_case("root") {
            Err(InvalidUsername)
        } else {
            Ok(())
        }
    }
}

assert!(serde_json::from_str::("\"\"").is_err());
assert!(serde_json::from_str::("\"root\"").is_err());
assert!(serde_json::from_str::("\"nobody\"").is_ok());

assert!(serde_json::from_str::<&UsernameRef>("\"\"").is_err());
assert!(serde_json::from_str::<&UsernameRef>("\"root\"").is_err());
assert!(serde_json::from_str::<&UsernameRef>("\"nobody\"").is_ok());

Safety

Braid uses limited unsafe in order to be able to reinterpret string slices ([&str]) as the borrowed form. Because this functionality is provided as a macro, using the #![forbid(unsafe_code)] lint level on a crate that generates braids will result in compiler errors. Instead, the crate can be annotated with #![deny(unsafe_code)], which allows for overrides as appropriate. The functions that require unsafe to work correctly are annotated with #[allow(unsafe_code)], and all usages of unsafe that the macro generates are annotated with SAFETY code comments.

If strict adherence to forbid unsafe code is required, then the types can be segregated into an accessory crate without the prohibition, and then consumed safely from crates that otherwise forbid unsafe code.

Comments
  • Refactor to v0.2

    Refactor to v0.2

    This update looks to improve the API definitions a bit:

    Breaking changes

    • Reducing some excess generic-ness on Owned::new(), which now always takes String
    • Add more ergonomic Borrowed::from_static(&'static str), which panics for invalid fallible/normalized values, less unwrap()-ing in tests/startup code
      • Closes #10
    • Add impls of Ord and PartialOrd
      • Closes #11
    • Rename omit_clone, debug_impl, display_impl parameters
      • Now clone, debug, and display, respectively
    • Add impl From<Owned> for Arc<Borrowed> and impl From<Owned> for Rc<Borrowed>
    • Remove trait bound that requires Normalizer/Validator::Error implements StdError + Send + Sync
    • Remove blanket impl<T> Validator for T where T: Normalizer
      • Normalizer is now a subtrait of Validator and inherits the error type from Validator.
      • This allows validator to be implemented more efficiently
      • Does require that validator ensure the value is already in normalized form to preserve invariants
    • Remove a few extra impls of PartialEq

    New features

    • Add means to add attributes to just the owned type, just the borrowed type, or both
      • Closes #9
    • Types now implement StructuralEq and StructuralPartialEq, potentially enabling const pattern matching
      • See #8 for issues with pattern matching
    • Constify things a bit more
      • Closes #7
    • Now possible to wrap more types than just std::string::String
      • In particular, now can use smartstring::SmartString as an inner type
      • Thanks to the release of bytestring v1.1.0, can also use bytestring::ByteString
        • Closes #12
      • Examples includes an example of a minimal usable string type
    • Now possible to use braids in #![no_std] crates using no_std macro parameter (requires alloc).
    • aliri_braid crate itself is now no_std. Use of Normalizer requires the alloc feature (enabled by default).
    • #[braid_ref] is back, allowing creation of ref-only braids. Compatible with #![no_std] without alloc.

    cc: @emilgardis as another primary consumer of this crate

    opened by neoeinstein 5
  • no way to put proc-attributes on borrowed type

    no way to put proc-attributes on borrowed type

    // run cargo doc with `RUSTDOCFLAGS="--cfg nightly"`
    #![feature(doc_cfg)]
    use aliri_braid::braid;
    
    #[braid]
    #[cfg(any(docs, feature = "thing"))]
    #[cfg_attr(nightly, doc(cfg(feature = "thing")))]
    struct Thing;
    

    above example will put a cfg and doc_cfg on Thing, but not on ThingRef. This results in some wierd state for documentation, for example, docs will be (from real example) image

    I'd want to be able to put a #[doc(cfg(...))] on the Ref as well.

    opened by Emilgardis 3
  • implement `std::borrow::Borrow<str>` and `std::convert::AsRef<str>` for `Owned` and `Borrowed`

    implement `std::borrow::Borrow` and `std::convert::AsRef` for `Owned` and `Borrowed`

    Would it be possible to implement std::borrow::Borrow<str> and std::convert::AsRef<str> for Owned and Borrowed?

    This would be very useful, and I don't see any reason to not have this.

    opened by Emilgardis 3
  • feat: add no_expose parameter

    feat: add no_expose parameter

    In order to avoid exposing the inner type, we need to add a requirement on the Validator::Error type to ensure that we can at least convert from Infallible. To support this trivial implementation, I've added a from_infallible!() macro that provides that impl.

    Closes #14

    opened by neoeinstein 2
  • Ensure braids implement StructuralEq and StructuralPartialEq

    Ensure braids implement StructuralEq and StructuralPartialEq

    This will allow for using const values in pattern matching when that lands, as in the following:

    #[braid]
    struct MyData;
    
    const TEST_VAL: &MyDataRef = MyDataRef::from_str("test");
    
    match some_data_ref {
        TEST_VAL => println!("test!"),
        _ => println!("not a test…"),
    }
    
    opened by neoeinstein 2
  • Implement `From<Owned>` for `Cow<'_, Borrowed>`

    Implement `From` for `Cow<'_, Borrowed>`

    Similar to https://doc.rust-lang.org/std/string/struct.String.html#impl-From%3CString%3E-4 This would allow

    #[aliri_braid::braid]
    pub struct Foo;
    
    struct Bar<'a> {
        foo: Cow<'a, FooRef>,
    }
    
    fn main() {
        let foo_owned: Foo = Foo::from("Hello!");
        let bar = Bar { foo: foo.into() }
    }
    
    opened by Emilgardis 1
  • RUSTSEC-2021-0139: ansi_term is Unmaintained

    RUSTSEC-2021-0139: ansi_term is Unmaintained

    ansi_term is Unmaintained

    | Details | | | ------------------- | ---------------------------------------------- | | Status | unmaintained | | Package | ansi_term | | Version | 0.12.1 | | URL | https://github.com/ogham/rust-ansi-term/issues/72 | | Date | 2021-08-18 |

    The maintainer has adviced this crate is deprecated and will not receive any maintenance.

    The crate does not seem to have much dependencies and may or may not be ok to use as-is.

    Last release seems to have been three years ago.

    Possible Alternative(s)

    The below list has not been vetted in any way and may or may not contain alternatives;

    See advisory page for additional details.

    opened by github-actions[bot] 0
  • Add an automated renaming for `String` -> `Str`

    Add an automated renaming for `String` -> `Str`

    Consider adding a new default renaming.

    Right now, the default naming strategy names the borrowed form by adding Ref to the end of the owned type name. Thus, MyType becomes MyTypeRef. There is a carve out for owned type names ending in Buf. In that case, the borrowed form just drops the Buf, i.e. MyDataBuf becomes MyData.

    There is one more pattern that can be found in the standard libraries, seen in OsString -> OsStr. This would be a default renaming for types that end in String to use Str in the borrowed form, i.e. CoolBearString -> CoolBearStr. This should only be done where the suffix is String, so MyStringOfThings would still fall to the default renaming strategy, having a borrowed form of MyStringOfThingsRef. In this way, it is orthogonal to the existing Buf suffix renaming strategy.

    This would be a breaking change (as most changes in this crate are), as there may already be code out there that depends on the default naming strategy (expects CoolBearString -> CoolBearStringRef).

    good first issue 
    opened by neoeinstein 0
  • Add compact str example

    Add compact str example

    This is currently blocked on a publishing the remaining needed trait implementation in the compact_str crate. Once that has been released, we can remove the [patch.crates-io], update the version, and merge.

    opened by neoeinstein 0
  • Create example that uses `CompactString`

    Create example that uses `CompactString`

    Relies on ParkMyCar/compact_str#117, with a pending PR: ParkMyCar/compact_str#118.

    The example is already prepared, but needs to be uncommented and re-published when compact_str is released with the necessary trait.

    opened by neoeinstein 0
  • Provide an implementation of Ord/PartialOrd

    Provide an implementation of Ord/PartialOrd

    Because storing braids in BTreeMap/BTreeSet is cool.

    The other option is to make sure its relatively easy to put #[derive(Ord, PartialOrd)] on both the owned and borrowed forms.

    opened by neoeinstein 0
  • Generate unsafe code conditionally with feature

    Generate unsafe code conditionally with feature

    Only generated unsafe code when a feature (named "unsafe" or something) is enabled. It would be fine for this feature to be on by default, but would allow use in projects that forbid unsafe code.

    opened by mpfaff 4
Owner
Marcus Griep
Marcus Griep
A Platform-less, Runtime-less Actor Computing Model

CrossBus A Platform-Less, Runtime-Less Actor Computing Model Overview CrossBus is an implementation of Actor Computing Model, with the concept that Ru

Bruce Yuan 105 Apr 8, 2023
A statically typed language that can deeply improve the Python ecosystem

The Erg Programming Language This is the main source code repository for Erg. This contains the compiler and documentation. 日本語 | 简体中文 | 繁體中文 Erg can

The Erg Programming Language 2.1k Jan 1, 2023
Orion lang is a lispy programming language that is strongly and statically typed.

Orion Orion is a lisp inspired statically typed programming language written in Rust Install To install orion you can either: Download binary from the

Wafelack 226 Dec 17, 2022
beat saber is a strongly typed, self-documenting and highly performant programming language

beatsaber beat saber is a strongly typed, self-documenting and highly performant programming language. With beat saber we aimed to create a language t

Untitled 4 Jan 17, 2022
A Rust library for interacting with OpenAI's ChatGPT API, providing an easy-to-use interface and strongly typed structures.

ChatGPT Rust Library A Rust library for interacting with OpenAI's ChatGPT API. This library simplifies the process of making requests to the ChatGPT A

Arend-Jan 6 Mar 23, 2023
Rust language from simple to deep, and then to strengthen learning in multiple module

Rust Library This project is used to learn rust language from simple to deep, and then to strengthen learning in multiple module. It is used to help n

Summer 1 Sep 19, 2022
Strongly typed JSON library for Rust

Serde JSON   Serde is a framework for serializing and deserializing Rust data structures efficiently and generically. [dependencies] serde_json = "1.0

null 3.6k Jan 5, 2023
Strongly typed YAML library for Rust

Serde YAML This crate is a Rust library for using the Serde serialization framework with data in YAML file format. This library does not reimplement a

David Tolnay 669 Jan 1, 2023
Strongly typed routes for Rust

routetype This repository is a work in progress, experimental exploration of strongly typed routing in Rust. It follows my previous work with Yesod in

Michael Snoyman 32 Jul 22, 2022
Extensible, strongly-typed Rust OAuth2 client library

OAuth2 An extensible, strongly-typed implementation of OAuth2 (RFC 6749). Documentation is available on docs.rs. Release notes are available on GitHub

David Ramos 602 Dec 25, 2022
RefineDB - A strongly-typed document database that runs on any transactional key-value store.

RefineDB - A strongly-typed document database that runs on any transactional key-value store.

Heyang Zhou 375 Jan 4, 2023
Strongly typed Gura library for Rust

Serde Gura This crate is a Rust library for using the Serde serialization framework with data in Gura file format. This library does not re-implement

Gura Config Lang 12 Nov 14, 2022
Strongly typed Elasticsearch DSL written in Rust

Strongly typed Elasticsearch DSL written in Rust This is an unofficial library and doesn't yet support all the DSL, it's still work in progress. Featu

null 173 Jan 6, 2023
Strongly typed, extensible event mediator.

mediatrix Strongly typed, extensible event mediator. For more info and explanation, please see the docs. Usage Sync use mediatrix::synchronous::basic:

nyvs 2 Nov 14, 2022
Lightweight, Strongly Typed Xata Client written in Rust

xata-rs: Lightweight, Strongly Typed Xata Client xata-rs is a third party Xata client, allowing interaction with Xata's REST API. Adding xata-rs (WIP)

Alvaro Machuca Recalde 4 Jun 12, 2023
Use LLMs to generate strongly-typed values

Magic Instantiate Quickstart use openai_magic_instantiate::*; #[derive(MagicInstantiate)] struct Person { // Descriptions can help the LLM unders

Grant Slatton 4 Feb 20, 2024
Emoji-printer - Utility to convert strings with emoji shortcodes to strings with the emoji unicode

Emoji Printer Intro Utility to convert strings with emoji shortcodes (:sushi:) to strings with the emoji unicode ( ?? ) Install cargo add emoji-printe

Kyle Scully 2 Dec 30, 2021
Firecracker takes your HTTP logs and uses them to map your API flows and to detect anomalies in them.

Who is BLST and what do we do? BLST (Business Logic Security Testing) is a startup company that's developing an automatic penetration tester, replacin

BLST 692 Jan 2, 2023
Explain semver requirements by converting them into less than, greater than, and/or equal to form.

semver-explain Convert SemVer requirements to their most-obvious equivalents. semver-explain is a CLI tool to explain Semantic Versioning requirements

Andrew Lilley Brinker 27 Oct 29, 2022
🦸‍♂️ Recast migrates your old extensions to AndroidX, making them compatible with the latest version of Kodular.

Recast Recast helps make your old extensions compatible with Kodular Creator version 1.5.0 or above. Prerequisites To use Recast, you need to have Jav

Shreyash Saitwal 13 Dec 28, 2022