ketos_derive

Crates.ioketos_derive
lib.rsketos_derive
version0.12.0
sourcesrc
created_at2017-04-23 20:08:21.286358
updated_at2019-12-25 02:45:56.566124
descriptionDerive traits for Ketos scripting language
homepagehttps://github.com/murarth/ketos
repositoryhttps://github.com/murarth/ketos
max_upload_size
id11752
size33,184
Murarth (murarth)

documentation

https://docs.rs/ketos_derive/

README

ketos_derive

Provides a set of custom #[derive(...)] macros for convenience when using Ketos.

One or more of the following names can be added to the derive attribute of any struct or enum value. For example:

extern crate ketos;

#[derive(Clone, Debug, ForeignValue, FromValue, IntoValue)]
struct Foo {
    // ...
}

derive(ForeignValue)

Implements ForeignValue for the given type. The only method implemented by this macro is type_name. All other methods retain their default implementations.

The ForeignValue trait must be implemented (either manually or using this derive) for any of the other derive implementations to succeed.

derive(FromValue)

Implements FromValue for the given type.

The generated implementation requires that the instance of the type held by the Ketos Value is unique, i.e. that the contained Rc has a reference count of 1.

If your type implements Clone, derive(FromValueClone) will instead generate an implementation of FromValue that clones the contained value, if necessary.

derive(FromValueClone)

Implements FromValue for the given type, provided that the type implements the Clone trait.

If the value contained in the Ketos Value is not unique, the result will be a clone of the contained value.

derive(FromValueRef)

Implements FromValueRef for the given type.

derive(IntoValue)

Implements Into<Value> for the given type.

Commit count: 234

cargo fmt