Project restructuring, dedicated traits, TryScribeString derive

This commit is contained in:
Pantonshire committed 2021-05-19 10:16:22 +01:00
1 parent 6a2ffc19eb
commit 0c4c252be9
14 files changed
+245 -119

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
[package]
name = "enumscribe"
version = "0.1.0"
authors = ["Tom Panton <pantonshire@gmail.com>"]
edition = "2018"
license = "MIT"
description = "Procedural macros for converting between enums and strings"
[dependencies]
enumscribe_derive = { path = "../enumscribe_derive" }
+34
View File
@@ -0,0 +1,34 @@
#[macro_use]
extern crate enumscribe_derive;
use std::borrow::Cow;
pub use enumscribe_derive::*;
//TODO
pub trait ScribeStaticStr {
fn scribe(&self) -> &'static str;
}
//TODO
pub trait TryScribeStaticStr {
fn try_scribe(&self) -> Option<&'static str>;
}
pub trait ScribeString {
fn scribe(&self) -> String;
}
pub trait TryScribeString {
fn try_scribe(&self) -> Option<String>;
}
//TODO
pub trait ScribeCowStr {
fn scribe(&self) -> Cow<'static, str>;
}
//TODO
pub trait TryScribeCowStr {
fn try_scribe(&self) -> Option<Cow<'static, str>>;
}