pub trait TrimFunctions{
// Provided methods
fn trim_export(&self) -> Self { ... }
fn remove_type_word(&self) -> Self { ... }
fn replace_equals(&self) -> Self { ... }
}
Expand description
Trait implementing trim functions that you can use on a
FormattedType
.
You can use multiple functions on a single FormattedType
like so:
use crate::generate_typedoc;
use crate::TrimFunctions;
use specta::Type;
#[derive(Type)]
struct Foo {
bar: String,
baz: i32
}
let data = generate_typedoc::<Foo>().unwrap();
let trimmed_a = data.trim_export().to_string();
assert_eq!(trimmed_a, "type Foo = { bar: string, baz: number}");
let trimmed_b = data.trim_export().replace_equals().remove_type_word().to_string();
assert_eq!(trimmed_b, "Foo { bar: string, baz: number }")
Provided Methods§
fn trim_export(&self) -> Self
fn remove_type_word(&self) -> Self
fn replace_equals(&self) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.