Rename Annotation trait to Annotate
This commit is contained in:
@@ -645,7 +645,7 @@ impl<'r, 'm> MetatypeFunctionBuilder<'r, 'm> {
|
||||
}
|
||||
}
|
||||
|
||||
pub trait Annotation {
|
||||
pub trait Annotate {
|
||||
fn annotation() -> impl Display;
|
||||
}
|
||||
|
||||
@@ -699,7 +699,7 @@ macro_rules! impl_primitive {
|
||||
fn build(_b: &mut TypeBuilder) {}
|
||||
}
|
||||
|
||||
impl Annotation for $rty {
|
||||
impl Annotate for $rty {
|
||||
fn annotation() -> impl Display {
|
||||
$lty
|
||||
}
|
||||
@@ -867,9 +867,9 @@ impl_ptr!(Option<&mut T>, true);
|
||||
|
||||
macro_rules! impl_ref_annotation {
|
||||
($ty:ty) => {
|
||||
impl<T> Annotation for $ty
|
||||
impl<T> Annotate for $ty
|
||||
where
|
||||
T: Annotation,
|
||||
T: Annotate,
|
||||
{
|
||||
fn annotation() -> impl Display {
|
||||
display!("{}", T::annotation())
|
||||
@@ -1005,9 +1005,9 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> Annotation for [T]
|
||||
impl<T> Annotate for [T]
|
||||
where
|
||||
T: Annotation,
|
||||
T: Annotate,
|
||||
{
|
||||
fn annotation() -> impl Display {
|
||||
display!("{}[]", T::annotation())
|
||||
@@ -1035,9 +1035,9 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, const N: usize> Annotation for [T; N]
|
||||
impl<T, const N: usize> Annotate for [T; N]
|
||||
where
|
||||
T: Annotation,
|
||||
T: Annotate,
|
||||
{
|
||||
fn annotation() -> impl Display {
|
||||
display!("{}[]", T::annotation())
|
||||
@@ -1106,25 +1106,25 @@ impl_externcfn!(fn(A, B, C, D, E, F, G) -> H);
|
||||
impl_externcfn!(fn(A, B, C, D, E, F, G, H) -> I);
|
||||
impl_externcfn!(fn(A, B, C, D, E, F, G, H, I) -> J);
|
||||
|
||||
impl<'s> Annotation for &'s [u8] {
|
||||
impl<'s> Annotate for &'s [u8] {
|
||||
fn annotation() -> impl Display {
|
||||
"string"
|
||||
}
|
||||
}
|
||||
|
||||
impl<'s> Annotation for &'s str {
|
||||
impl<'s> Annotate for &'s str {
|
||||
fn annotation() -> impl Display {
|
||||
"string"
|
||||
}
|
||||
}
|
||||
|
||||
impl Annotation for Vec<u8> {
|
||||
impl Annotate for Vec<u8> {
|
||||
fn annotation() -> impl Display {
|
||||
"string"
|
||||
}
|
||||
}
|
||||
|
||||
impl Annotation for String {
|
||||
impl Annotate for String {
|
||||
fn annotation() -> impl Display {
|
||||
"string"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#![allow(non_camel_case_types)]
|
||||
use crate::{
|
||||
__internal::{disp, display},
|
||||
Annotation,
|
||||
Annotate,
|
||||
};
|
||||
use std::{fmt::Display, marker::PhantomData};
|
||||
|
||||
@@ -9,7 +9,7 @@ enum Marker {}
|
||||
|
||||
pub struct any(Marker);
|
||||
|
||||
impl Annotation for any {
|
||||
impl Annotate for any {
|
||||
fn annotation() -> impl Display {
|
||||
"any"
|
||||
}
|
||||
@@ -17,7 +17,7 @@ impl Annotation for any {
|
||||
|
||||
pub struct many(Marker);
|
||||
|
||||
impl Annotation for many {
|
||||
impl Annotate for many {
|
||||
fn annotation() -> impl Display {
|
||||
"..."
|
||||
}
|
||||
@@ -25,7 +25,7 @@ impl Annotation for many {
|
||||
|
||||
pub struct nil(Marker);
|
||||
|
||||
impl Annotation for nil {
|
||||
impl Annotate for nil {
|
||||
fn annotation() -> impl Display {
|
||||
"nil"
|
||||
}
|
||||
@@ -33,7 +33,7 @@ impl Annotation for nil {
|
||||
|
||||
pub struct lightuserdata(Marker);
|
||||
|
||||
impl Annotation for lightuserdata {
|
||||
impl Annotate for lightuserdata {
|
||||
fn annotation() -> impl Display {
|
||||
"lightuserdata"
|
||||
}
|
||||
@@ -41,10 +41,10 @@ impl Annotation for lightuserdata {
|
||||
|
||||
pub struct table<K, V>(Marker, PhantomData<*mut [(K, V)]>);
|
||||
|
||||
impl<K, V> Annotation for table<K, V>
|
||||
impl<K, V> Annotate for table<K, V>
|
||||
where
|
||||
K: Annotation,
|
||||
V: Annotation,
|
||||
K: Annotate,
|
||||
V: Annotate,
|
||||
{
|
||||
fn annotation() -> impl Display {
|
||||
display!("table<{}, {}>", K::annotation(), V::annotation())
|
||||
@@ -53,7 +53,7 @@ where
|
||||
|
||||
pub struct function(Marker);
|
||||
|
||||
impl Annotation for function {
|
||||
impl Annotate for function {
|
||||
fn annotation() -> impl Display {
|
||||
"function"
|
||||
}
|
||||
@@ -63,9 +63,9 @@ pub struct fun<I, O>(Marker, PhantomData<fn(I) -> O>);
|
||||
|
||||
macro_rules! impl_fun {
|
||||
(fn($($arg:ident),*)) => {
|
||||
impl<$($arg,)*> Annotation for fun<($($arg,)*), ()>
|
||||
impl<$($arg,)*> Annotate for fun<($($arg,)*), ()>
|
||||
where
|
||||
$($arg: Annotation,)*
|
||||
$($arg: Annotate,)*
|
||||
{
|
||||
fn annotation() -> impl Display {
|
||||
disp(|f| {
|
||||
@@ -79,10 +79,10 @@ macro_rules! impl_fun {
|
||||
};
|
||||
|
||||
(fn($($arg:ident),*) -> $ret:ident) => {
|
||||
impl<$($arg,)* $ret> Annotation for fun<($($arg,)*), $ret>
|
||||
impl<$($arg,)* $ret> Annotate for fun<($($arg,)*), $ret>
|
||||
where
|
||||
$($arg: Annotation,)*
|
||||
$ret: Annotation,
|
||||
$($arg: Annotate,)*
|
||||
$ret: Annotate,
|
||||
{
|
||||
fn annotation() -> impl Display {
|
||||
disp(|f| {
|
||||
@@ -111,7 +111,7 @@ impl_fun!(fn(A, B, C, D, E, F, G, H, I) -> J);
|
||||
|
||||
pub struct userdata(Marker);
|
||||
|
||||
impl Annotation for userdata {
|
||||
impl Annotate for userdata {
|
||||
fn annotation() -> impl Display {
|
||||
"userdata"
|
||||
}
|
||||
@@ -119,7 +119,7 @@ impl Annotation for userdata {
|
||||
|
||||
pub struct thread(Marker);
|
||||
|
||||
impl Annotation for thread {
|
||||
impl Annotate for thread {
|
||||
fn annotation() -> impl Display {
|
||||
"thread"
|
||||
}
|
||||
@@ -127,7 +127,7 @@ impl Annotation for thread {
|
||||
|
||||
pub struct cdata(Marker);
|
||||
|
||||
impl Annotation for cdata {
|
||||
impl Annotate for cdata {
|
||||
fn annotation() -> impl Display {
|
||||
"cdata"
|
||||
}
|
||||
@@ -135,10 +135,10 @@ impl Annotation for cdata {
|
||||
|
||||
pub struct Either<T, U>(Marker, PhantomData<(T, U)>);
|
||||
|
||||
impl<T, U> Annotation for Either<T, U>
|
||||
impl<T, U> Annotate for Either<T, U>
|
||||
where
|
||||
T: Annotation,
|
||||
U: Annotation,
|
||||
T: Annotate,
|
||||
U: Annotate,
|
||||
{
|
||||
fn annotation() -> impl Display {
|
||||
display!("({} | {})", T::annotation(), U::annotation())
|
||||
@@ -149,9 +149,9 @@ pub struct OneOf<X>(Marker, PhantomData<X>);
|
||||
|
||||
macro_rules! impl_oneof {
|
||||
($($ty:ident),+) => {
|
||||
impl<$($ty),+> Annotation for OneOf<($($ty,)+)>
|
||||
impl<$($ty),+> Annotate for OneOf<($($ty,)+)>
|
||||
where
|
||||
$($ty: Annotation),+
|
||||
$($ty: Annotate),+
|
||||
{
|
||||
fn annotation() -> impl Display {
|
||||
disp(|f| {
|
||||
@@ -174,18 +174,18 @@ impl_oneof!(A, B, C, D, E, F, G);
|
||||
impl_oneof!(A, B, C, D, E, F, G, H);
|
||||
impl_oneof!(A, B, C, D, E, F, G, H, I);
|
||||
|
||||
impl<T> Annotation for Option<T>
|
||||
impl<T> Annotate for Option<T>
|
||||
where
|
||||
T: Annotation,
|
||||
T: Annotate,
|
||||
{
|
||||
fn annotation() -> impl Display {
|
||||
display!("{}?", T::annotation())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T, E> Annotation for Result<T, E>
|
||||
impl<T, E> Annotate for Result<T, E>
|
||||
where
|
||||
T: Annotation,
|
||||
T: Annotate,
|
||||
{
|
||||
fn annotation() -> impl Display {
|
||||
display!("{}", T::annotation())
|
||||
|
||||
Reference in New Issue
Block a user