Skip to content

Change conversion methods to take objects by values #61

Open
@d-unsed

Description

@d-unsed

The following methods should take self by value, because technically they return the same Ruby
objects converted to another Rust type.

  • Object::to

    Object::to<T: Object>(&self) -> T

    changes to

    Object::convert_into<T: Object>(self) -> T
  • Object::try_convert_to

    Object::try_convert_to<T: VerifiedObject>(&self) -> Result<T>

    changes to

    Object::try_convert_into<T: VerifiedObject>(self) -> Result<T>
  • Object::to_any_object()

    Object::to_any_object(&self) -> AnyObject

    changes to

    Object::into_any_object(&self) -> AnyObject

For example:

let fixnum = some_object.try_convert_into::<Fixnum>();

some_object should be consumed by convert_into, because fixnum and some_object correspond to the same object in Ruby.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions