field_access
A library for dynamic access to struct fields with #![no_std]
support.
Field access is enabled by the FieldAccess
trait which can be implemented
using a derive macro by the same name.
use FieldAccess;
let mut foo = Foo ;
// Immutable field access.
if let Some = foo.field
// Mutable field access.
if let Some = foo.field_mut
assert_eq!;
Cargo features
alloc
: Provide methods to interact with types from the Rust core allocation and collections library includingString
andVec<T>
. This feature pulls in thealloc
library as a dependency and is enabled by default.derive
: Provide a derive macro for theFieldAccess
trait. This feature is enabled by default.
License
The source code of field_access is licensed under either of Apache License, Version 2.0 or MIT license at your option.