This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git
The following commit(s) were added to refs/heads/main by this push:
new afa8dce8 [Rust] Rename `rs_class` to `rs_object` (#908)
afa8dce8 is described below
commit afa8dce89705e844457899b42e3d0f69da8c5c03
Author: Linzhang Li <[email protected]>
AuthorDate: Tue Nov 3 21:38:03 2026 -0500
[Rust] Rename `rs_class` to `rs_object` (#908)
## Summary
This PR renames the attribute macro that defines an object type in Rust
from `#[rs_class]` to
`#[rs_object]`. The behavior and the arguments are unchanged:
```rust
use tvm_ffi::object::ObjectRef;
use tvm_ffi::{def_object_ref, rs_object, Object};
#[rs_object("my.Point")]
pub struct PointObj {
base: Object,
pub x: i64,
pub label: tvm_ffi::String,
}
def_object_ref!(pub Point, ObjectRef, PointObj);
```
---
docs/guides/rust_lang_guide.md | 16 ++++++++--------
python/tvm_ffi/stub/rust_generator/codegen.py | 4 ++--
python/tvm_ffi/stub/rust_generator/consts.py | 2 +-
rust/tvm-ffi-macros/src/lib.rs | 14 +++++++-------
rust/tvm-ffi-macros/src/object_macros.rs | 18 +++++++++---------
.../src/{rs_class.rs => rs_object.rs} | 22 +++++++++++-----------
rust/tvm-ffi/src/any.rs | 4 ++--
rust/tvm-ffi/src/lib.rs | 2 +-
rust/tvm-ffi/src/reflection/registry.rs | 4 ++--
rust/tvm-ffi/src/reflection/unsafe_init.rs | 6 +++---
.../tests/{test_rs_class.rs => test_rs_object.rs} | 22 +++++++++++-----------
11 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/docs/guides/rust_lang_guide.md b/docs/guides/rust_lang_guide.md
index 8b784f32..a2b41352 100644
--- a/docs/guides/rust_lang_guide.md
+++ b/docs/guides/rust_lang_guide.md
@@ -73,10 +73,10 @@ increment its reference count. Rust tracks the view's
lifetime so it cannot outl
the value it borrows. A custom pair illustrates owning and borrowed access:
```rust
-use tvm_ffi::{def_object_ref, rs_class, Any, AnyView, Object};
+use tvm_ffi::{def_object_ref, rs_object, Any, AnyView, Object};
use tvm_ffi::object::ObjectRef;
-#[rs_class("my.MyPair")]
+#[rs_object("my.MyPair")]
pub struct MyPairObj {
base: Object,
pub first: i64,
@@ -333,7 +333,7 @@ reflected field names, must be unique in the type.
### Defining Object Types from Their Fields
-`#[rs_class]` defines such a type from its object struct, like Python's
+`#[rs_object]` defines such a type from its object struct, like Python's
`py_class`. The first field, `base`, is the parent's object; every other field
is reflected, and `#[reflect(...)]` sets its flags, name and doc string.
`reflection = path` after the type key is `#[type_reflection(path)]`.
@@ -342,9 +342,9 @@ C++ `TVM_FFI_DEFINE_OBJECT_REF_METHODS_NOTNULLABLE` does:
```rust
use tvm_ffi::object::ObjectRef;
-use tvm_ffi::{def_object_ref, rs_class, Object};
+use tvm_ffi::{def_object_ref, rs_object, Object};
-#[rs_class("my.Point", s_eq_hash_kind = "TreeNode")]
+#[rs_object("my.Point", s_eq_hash_kind = "TreeNode")]
pub struct PointObj {
base: Object,
pub x: i64,
@@ -354,7 +354,7 @@ pub struct PointObj {
def_object_ref!(pub Point, ObjectRef, PointObj);
-#[rs_class("my.Point3", final)]
+#[rs_object("my.Point3", final)]
pub struct Point3Obj {
base: PointObj,
pub z: i64,
@@ -367,7 +367,7 @@ assert_eq!((point3.x, point3.z), (1, 3));
let point: Point = point3.into();
```
-`#[rs_class]` adds `#[repr(C)]`, `Deref` to the parent's object and
+`#[rs_object]` adds `#[repr(C)]`, `Deref` to the parent's object and
`Point3Obj::new`, which takes the parent's object, then the fields: a scalar
(`bool`, an integer or a float) as its own type, so that a literal infers as
it,
and any other field from anything that converts into it, as the `new` of a type
@@ -388,7 +388,7 @@ dropping, the field getter reads them as None and the
object's deleter skips
them. An `init_off` field stays all-zero after `__ffi_init__`, so its type must
take all-zero bytes as a value, as a scalar or `Option<T>` does; a reference or
a string does not, and fails the type's registration. The parent's object must
-implement `ShallowCopy` and `UnsafeInit`, as `rs_class` types and non-final C++
+implement `ShallowCopy` and `UnsafeInit`, as `rs_object` types and non-final
C++
types bound by `tvm-ffi-stubgen` do.
### Converting Borrowed Values into `Any`
diff --git a/python/tvm_ffi/stub/rust_generator/codegen.py
b/python/tvm_ffi/stub/rust_generator/codegen.py
index 0d2629df..bfba4bea 100644
--- a/python/tvm_ffi/stub/rust_generator/codegen.py
+++ b/python/tvm_ffi/stub/rust_generator/codegen.py
@@ -26,7 +26,7 @@ the verdict of :mod:`tvm_ffi.stub.layout`:
its own type, the latter a scalar as its own type and anything else as
``impl Into``. ``custom-new`` leaves the wrapper's ``new`` to hand-written
code and names the generated one ``from_fields``. A type that is not final
- can be the parent of a type defined in Rust (``tvm_ffi::rs_class``): its
+ can be the parent of a type defined in Rust (``tvm_ffi::rs_object``): its
``<Leaf>Obj::new`` is public, and its object implements ``ShallowCopy`` and
``UnsafeInit`` when every ancestor's is generated too (a ``ty-map``'d one is
hand-written and may not). ``<Leaf>Obj::new`` of a final type is
crate-private.
@@ -528,7 +528,7 @@ class _ObjectRenderer:
``<Leaf>Obj::new`` takes every field as its own type, so the parent's,
generated
or hand-written, takes what it hands on. The wrapper's ``new`` takes a
scalar
field as its own type and any other as ``impl Into``
(:func:`_param_type`), as
- ``#[rs_class]``'s ``new`` does, and converts it on the way to
``<Leaf>Obj::new``.
+ ``#[rs_object]``'s ``new`` does, and converts it on the way to
``<Leaf>Obj::new``.
``custom-new`` names the wrapper's allocator ``from_fields`` instead.
``<Leaf>Obj::new`` of a type that is not final is public: a subtype
defined in Rust
builds its parent's object with it.
diff --git a/python/tvm_ffi/stub/rust_generator/consts.py
b/python/tvm_ffi/stub/rust_generator/consts.py
index aea485d5..5db26ab8 100644
--- a/python/tvm_ffi/stub/rust_generator/consts.py
+++ b/python/tvm_ffi/stub/rust_generator/consts.py
@@ -85,7 +85,7 @@ RUST_SCALAR_WIDTHS = {
"f64": 8,
}
-#: Parameters of the wrapper's allocator taken as their own type, as
``#[rs_class]``'s
+#: Parameters of the wrapper's allocator taken as their own type, as
``#[rs_object]``'s
#: ``new`` takes them: a literal infers only from its exact type. Any other
parameter is
#: ``impl Into<T>``; ``<Leaf>Obj::new`` takes every one as its own type.
RUST_EXACT_PARAMS = frozenset(
diff --git a/rust/tvm-ffi-macros/src/lib.rs b/rust/tvm-ffi-macros/src/lib.rs
index 20be4b00..1dcee2fe 100644
--- a/rust/tvm-ffi-macros/src/lib.rs
+++ b/rust/tvm-ffi-macros/src/lib.rs
@@ -24,7 +24,7 @@ mod def_object_ref;
mod dispatch;
mod match_any;
mod object_macros;
-mod rs_class;
+mod rs_object;
mod utils;
/// Generate source-ordered runtime type dispatch from `prefix_*` handlers.
@@ -168,10 +168,10 @@ pub fn derive_object_ref(input: TokenStream) ->
TokenStream {
/// Python see the fields.
///
/// ```ignore
-/// use tvm_ffi::{def_object_ref, rs_class};
+/// use tvm_ffi::{def_object_ref, rs_object};
///
/// /// A pair of values under a `Base`.
-/// #[rs_class("my_ext.Pair", final)]
+/// #[rs_object("my_ext.Pair", final)]
/// pub struct PairObj {
/// base: BaseObj,
/// pub first: tvm_ffi::String,
@@ -188,7 +188,7 @@ pub fn derive_object_ref(input: TokenStream) -> TokenStream
{
///
/// The first field, `base`, is the parent's object, as the base class of a C++
/// object is: `base: Object` for a type under `ffi.Object`. The parent's
object
-/// must implement `ShallowCopy` and [`UnsafeInit`], as `rs_class` types and
+/// must implement `ShallowCopy` and [`UnsafeInit`], as `rs_object` types and
/// non-final C++ types bound by `tvm-ffi-stubgen` do. Every other field is
/// reflected; `#[reflect(writable, seq_hash_ignore, ...)]` gives a field the
/// [`FieldFlags`] of those names, and `name` and `doc` as for
@@ -230,8 +230,8 @@ pub fn derive_object_ref(input: TokenStream) -> TokenStream
{
/// [`UnsafeInit`]: ../tvm_ffi/reflection/trait.UnsafeInit.html
#[proc_macro_error]
#[proc_macro_attribute]
-pub fn rs_class(args: TokenStream, item: TokenStream) -> TokenStream {
- rs_class::rs_class(args, item)
+pub fn rs_object(args: TokenStream, item: TokenStream) -> TokenStream {
+ rs_object::rs_object(args, item)
}
/// Define the reference to an object type, as C++
@@ -260,7 +260,7 @@ pub fn rs_class(args: TokenStream, item: TokenStream) ->
TokenStream {
///
/// Attributes and visibility before the name go on the struct. `crate = path`
/// after the object type is where the generated code finds tvm-ffi, as for
-/// [`rs_class`].
+/// [`rs_object`].
#[proc_macro_error]
#[proc_macro]
pub fn def_object_ref(input: TokenStream) -> TokenStream {
diff --git a/rust/tvm-ffi-macros/src/object_macros.rs
b/rust/tvm-ffi-macros/src/object_macros.rs
index 2bbf0714..fc9b2449 100644
--- a/rust/tvm-ffi-macros/src/object_macros.rs
+++ b/rust/tvm-ffi-macros/src/object_macros.rs
@@ -33,13 +33,13 @@ pub fn derive_object(input: proc_macro::TokenStream) ->
TokenStream {
/// The `ObjectCore` impl of an object struct, and its `ShallowCopy` when it
/// registers reflection, naming the tvm-ffi crate `tvm_ffi_crate`.
///
-/// `rs_class` registers the reflection of a type without `#[reflect]` fields
+/// `rs_object` registers the reflection of a type without `#[reflect]` fields
/// or `#[type_s_eq_hash_kind]` too, with the creator of its `UnsafeInit`, as
-/// `#[rs_class]` does.
+/// `#[rs_object]` does.
pub(crate) fn expand_object(
derive_input: &DeriveInput,
tvm_ffi_crate: &TokenStream2,
- rs_class: bool,
+ rs_object: bool,
) -> TokenStream2 {
let struct_name = derive_input.ident.clone();
@@ -103,7 +103,7 @@ pub(crate) fn expand_object(
}
.expect("First field must be `<base_name>: <ObjectCoreType>`");
- let reflection = Reflection::parse(derive_input, rs_class);
+ let reflection = Reflection::parse(derive_input, rs_object);
assert!(
reflection.is_none() || (type_register && get_attr(derive_input,
"type_index").is_none()),
"#[reflect], #[type_s_eq_hash_kind] and #[type_reflection] need
#[type_register] and no \
@@ -295,7 +295,7 @@ struct Reflection {
/// The reflected fields.
reflected: Vec<ReflectedField>,
/// Whether the type registers the creator of its `UnsafeInit`, as an
- /// `#[rs_class]` type does.
+ /// `#[rs_object]` type does.
unsafe_init: bool,
}
@@ -383,8 +383,8 @@ fn doc_comment(attrs: &[syn::Attribute]) -> String {
impl Reflection {
/// The type's reflection, or `None` when it declares none and is not an
- /// `rs_class`.
- fn parse(derive_input: &DeriveInput, rs_class: bool) -> Option<Self> {
+ /// `rs_object`.
+ fn parse(derive_input: &DeriveInput, rs_object: bool) -> Option<Self> {
let kind = get_attr(derive_input, "type_s_eq_hash_kind").map(|attr| {
let kind = attr_to_str(attr);
syn::Ident::new(&kind.value(), kind.span())
@@ -421,7 +421,7 @@ impl Reflection {
reflected.push(field);
}
}
- if kind.is_none() && methods.is_none() && reflected.is_empty() &&
!rs_class {
+ if kind.is_none() && methods.is_none() && reflected.is_empty() &&
!rs_object {
return None;
}
Some(Self {
@@ -433,7 +433,7 @@ impl Reflection {
.expect("First field must be `<base_name>: <ObjectCoreType>`"),
field_ids,
reflected,
- unsafe_init: rs_class,
+ unsafe_init: rs_object,
})
}
diff --git a/rust/tvm-ffi-macros/src/rs_class.rs
b/rust/tvm-ffi-macros/src/rs_object.rs
similarity index 94%
rename from rust/tvm-ffi-macros/src/rs_class.rs
rename to rust/tvm-ffi-macros/src/rs_object.rs
index b19a6ab9..d268ea1e 100644
--- a/rust/tvm-ffi-macros/src/rs_class.rs
+++ b/rust/tvm-ffi-macros/src/rs_object.rs
@@ -26,16 +26,16 @@ use syn::{parse_macro_input, Data, DeriveInput, Fields,
LitBool, LitInt, LitStr,
use crate::object_macros::expand_object;
use crate::utils::get_tvm_ffi_crate;
-pub(crate) fn rs_class(args: TokenStream, item: TokenStream) -> TokenStream {
- let args = parse_macro_input!(args as RsClassArgs);
+pub(crate) fn rs_object(args: TokenStream, item: TokenStream) -> TokenStream {
+ let args = parse_macro_input!(args as RsObjectArgs);
let item = parse_macro_input!(item as DeriveInput);
expand(&args, &item)
.unwrap_or_else(|error| error.to_compile_error())
.into()
}
-/// `#[rs_class("type.key", final, ...)]`.
-struct RsClassArgs {
+/// `#[rs_object("type.key", final, ...)]`.
+struct RsObjectArgs {
type_key: LitStr,
type_final: bool,
s_eq_hash_kind: Option<LitStr>,
@@ -45,15 +45,15 @@ struct RsClassArgs {
tvm_ffi_crate: Option<Path>,
}
-impl Parse for RsClassArgs {
+impl Parse for RsObjectArgs {
fn parse(input: ParseStream) -> syn::Result<Self> {
let type_key = input.parse::<LitStr>().map_err(|error| {
syn::Error::new(
error.span(),
- "expected the type key first, as in
`#[rs_class(\"my.Point\")]`",
+ "expected the type key first, as in
`#[rs_object(\"my.Point\")]`",
)
})?;
- let mut args = RsClassArgs {
+ let mut args = RsObjectArgs {
type_key,
type_final: false,
s_eq_hash_kind: None,
@@ -110,17 +110,17 @@ impl Parse for RsClassArgs {
const EXPECTED_BASE: &str =
"the first field holds the parent's object: `base: Object` at the root,
else `base: ParentObj`";
-fn expand(args: &RsClassArgs, item: &DeriveInput) -> syn::Result<TokenStream2>
{
+fn expand(args: &RsObjectArgs, item: &DeriveInput) ->
syn::Result<TokenStream2> {
if !item.generics.params.is_empty() ||
item.generics.where_clause.is_some() {
return Err(syn::Error::new_spanned(
&item.generics,
- "an `rs_class` cannot be generic",
+ "an `rs_object` cannot be generic",
));
}
let Data::Struct(data) = &item.data else {
return Err(syn::Error::new(
item.ident.span(),
- "`rs_class` expects a struct",
+ "`rs_object` expects a struct",
));
};
let fields: Vec<&syn::Field> = match &data.fields {
@@ -129,7 +129,7 @@ fn expand(args: &RsClassArgs, item: &DeriveInput) ->
syn::Result<TokenStream2> {
Fields::Unnamed(fields) => {
return Err(syn::Error::new_spanned(
fields,
- "`rs_class` expects named fields",
+ "`rs_object` expects named fields",
));
}
};
diff --git a/rust/tvm-ffi/src/any.rs b/rust/tvm-ffi/src/any.rs
index a1f2ea68..f565b86f 100644
--- a/rust/tvm-ffi/src/any.rs
+++ b/rust/tvm-ffi/src/any.rs
@@ -240,10 +240,10 @@ impl Any {
/// reference count, and the returned reference cannot outlive `self`.
///
/// ```
- /// use tvm_ffi::{def_object_ref, rs_class, Any, AnyView, Object,
ObjectRefCore};
+ /// use tvm_ffi::{def_object_ref, rs_object, Any, AnyView, Object,
ObjectRefCore};
/// use tvm_ffi::object::ObjectRef;
///
- /// #[rs_class("my.MyPair", crate = tvm_ffi)]
+ /// #[rs_object("my.MyPair", crate = tvm_ffi)]
/// pub struct MyPairObj {
/// base: Object,
/// pub first: i64,
diff --git a/rust/tvm-ffi/src/lib.rs b/rust/tvm-ffi/src/lib.rs
index 31575818..495e0995 100644
--- a/rust/tvm-ffi/src/lib.rs
+++ b/rust/tvm-ffi/src/lib.rs
@@ -81,7 +81,7 @@ pub use crate::rvalue_ref::RValueRef;
pub use crate::static_init::run_static_init_blocks;
pub use crate::string::{Bytes, String};
pub use crate::type_traits::AnyCompatible;
-pub use tvm_ffi_macros::{def_object_ref, dispatch, match_any, rs_class};
+pub use tvm_ffi_macros::{def_object_ref, dispatch, match_any, rs_object};
pub use tvm_ffi_sys::TVMFFITypeIndex as TypeIndex;
pub use tvm_ffi_sys::{
diff --git a/rust/tvm-ffi/src/reflection/registry.rs
b/rust/tvm-ffi/src/reflection/registry.rs
index f733eadc..dd67ca46 100644
--- a/rust/tvm-ffi/src/reflection/registry.rs
+++ b/rust/tvm-ffi/src/reflection/registry.rs
@@ -23,7 +23,7 @@
//! and Python `_register_py_class`: the type metadata, one record per field
//! with C ABI getter and setter, one record per method, and the
//! `__ffi_shallow_copy__` and `__ffi_type_final__` type attributes; for an
-//! `#[rs_class]` type also the creator, and from it the `__ffi_new__` and
+//! `#[rs_object]` type also the creator, and from it the `__ffi_new__` and
//! `__ffi_init__` type attributes. Through them the C++ structural equality,
//! hashing and mutation, `repr`, deep copy, JSON graphs and Python's generated
//! classes reach the fields and methods of a Rust type, and construct it.
@@ -188,7 +188,7 @@ impl<N: ObjectCore> ObjectDef<N> {
/// `kind` of `None` takes the nearest ancestor's kind, as a C++ subclass
/// inherits `_type_s_eq_hash_kind`. `creator`, as C++ `ObjectDef` takes
/// the default or `UnsafeInit` constructor, makes an object of `N` for
- /// reflection to fill (`unsafe_init_creator::<N>` for an `#[rs_class]`).
+ /// reflection to fill (`unsafe_init_creator::<N>` for an `#[rs_object]`).
///
/// # Safety
///
diff --git a/rust/tvm-ffi/src/reflection/unsafe_init.rs
b/rust/tvm-ffi/src/reflection/unsafe_init.rs
index 4147db0a..4a16ee19 100644
--- a/rust/tvm-ffi/src/reflection/unsafe_init.rs
+++ b/rust/tvm-ffi/src/reflection/unsafe_init.rs
@@ -45,9 +45,9 @@ use crate::{Error, INTERNAL_ERROR};
/// An object type whose object can start with every field undefined, for
/// reflection to set the fields: C++ `UnsafeInit`.
///
-/// The creator that `#[rs_class]` registers for its type makes the object with
+/// The creator that `#[rs_object]` registers for its type makes the object
with
/// [`unsafe_init`], which a JSON graph read back, `__ffi_init__` and
-/// `__ffi_new__` then fill. `#[rs_class]` implements it for its object, so the
+/// `__ffi_new__` then fill. `#[rs_object]` implements it for its object, so
the
/// parent's object must implement it too: [`Object`] does, and so does the
/// object of a non-final C++ type bound by `tvm-ffi-stubgen`.
///
@@ -138,7 +138,7 @@ unsafe extern "C" fn unsafe_init_deleter<T:
UnsafeInit>(ptr: *mut c_void, flags:
}
}
-/// The creator of `T` (`TVMFFITypeMetadata::creator`) that `#[rs_class]`
+/// The creator of `T` (`TVMFFITypeMetadata::creator`) that `#[rs_object]`
/// registers, as C++ `ObjectCreatorUnsafeInit<T>`: the owned handle of an
/// object that [`unsafe_init`] made.
///
diff --git a/rust/tvm-ffi/tests/test_rs_class.rs
b/rust/tvm-ffi/tests/test_rs_object.rs
similarity index 96%
rename from rust/tvm-ffi/tests/test_rs_class.rs
rename to rust/tvm-ffi/tests/test_rs_object.rs
index cd38a413..4f2e5775 100644
--- a/rust/tvm-ffi/tests/test_rs_class.rs
+++ b/rust/tvm-ffi/tests/test_rs_object.rs
@@ -22,11 +22,11 @@ use tvm_ffi::reflection::{drop_if_defined, FieldFlags,
ObjectDef};
use tvm_ffi::*;
use tvm_ffi_sys::{TVMFFIFieldInfo, TVMFFIGetTypeInfo, TVMFFISEqHashKind,
TVMFFITypeInfo};
-// Object types defined in Rust by `#[rs_class]`, whose fields the C++
+// Object types defined in Rust by `#[rs_object]`, whose fields the C++
// structural engines, `repr` and deep copy see.
/// A root type, under `ffi.Object`.
-#[rs_class(
+#[rs_object(
"testing.rust.RsPoint",
s_eq_hash_kind = "TreeNode",
reflection = RsPointObj::reflect_methods
@@ -54,7 +54,7 @@ impl RsPointObj {
}
/// A subtype of a Rust-defined type, with a private field.
-#[rs_class("testing.rust.RsPoint3", final)]
+#[rs_object("testing.rust.RsPoint3", final)]
pub struct RsPoint3Obj {
base: RsPointObj,
pub z: i64,
@@ -70,7 +70,7 @@ def_object_ref!(
);
/// A subtype without fields, which still registers its reflection.
-#[rs_class("testing.rust.RsMarker", final)]
+#[rs_object("testing.rust.RsMarker", final)]
pub struct RsMarkerObj {
base: RsPointObj,
}
@@ -78,7 +78,7 @@ pub struct RsMarkerObj {
def_object_ref!(pub RsMarker, RsPoint, RsMarkerObj);
/// Scalar fields, whose literal arguments to `new` infer as the field types.
-#[rs_class("testing.rust.RsScalars", final)]
+#[rs_object("testing.rust.RsScalars", final)]
pub struct RsScalarsObj {
base: Object,
pub big: i64,
@@ -129,11 +129,11 @@ unsafe impl UnsafeInit for TestCxxClassBaseObj {
}
}
-// `def_object_ref!` takes any object type, not only an `rs_class` one.
+// `def_object_ref!` takes any object type, not only an `rs_object` one.
def_object_ref!(pub TestCxxClassBase, ObjectRef, TestCxxClassBaseObj);
/// A subtype of a C++ type.
-#[rs_class("testing.rust.RsCxxChild", final, s_eq_hash_kind = "TreeNode")]
+#[rs_object("testing.rust.RsCxxChild", final, s_eq_hash_kind = "TreeNode")]
pub struct RsCxxChildObj {
base: TestCxxClassBaseObj,
pub name: tvm_ffi::String,
@@ -142,7 +142,7 @@ pub struct RsCxxChildObj {
def_object_ref!(pub RsCxxChild, TestCxxClassBase, RsCxxChildObj);
/// A type that defines its own `__ffi_init__`, over which C++ generates none.
-#[rs_class("testing.rust.RsOwnInit", final, reflection =
RsOwnInitObj::reflect_methods)]
+#[rs_object("testing.rust.RsOwnInit", final, reflection =
RsOwnInitObj::reflect_methods)]
pub struct RsOwnInitObj {
base: Object,
pub v: i64,
@@ -161,7 +161,7 @@ impl RsOwnInitObj {
}
/// `init_off` fields, which `__ffi_init__` leaves all-zero: a value of these
types.
-#[rs_class("testing.rust.RsInitOff", final)]
+#[rs_object("testing.rust.RsInitOff", final)]
pub struct RsInitOffObj {
base: Object,
pub v: i64,
@@ -174,7 +174,7 @@ pub struct RsInitOffObj {
def_object_ref!(pub RsInitOff, ObjectRef, RsInitOffObj);
/// An `init_off` reference, which all-zero bytes leave undefined: its
registration fails.
-#[rs_class("testing.rust.RsInitOffReference", final)]
+#[rs_object("testing.rust.RsInitOffReference", final)]
pub struct RsInitOffReferenceObj {
base: Object,
#[reflect(init_off)]
@@ -187,7 +187,7 @@ mod reexported {
#[allow(dead_code)]
mod tvm_ffi {}
- #[::tvm_ffi::rs_class("testing.rust.RsReexported", crate = ::tvm_ffi)]
+ #[::tvm_ffi::rs_object("testing.rust.RsReexported", crate = ::tvm_ffi)]
pub struct ReexportedObj {
base: ::tvm_ffi::Object,
pub v: i64,