Skip to content

Add support for types in std::num. #438

Closed

Description

@mintlu8

This includes Wrapping<T>, Saturating<T>, NonZero<T>, NonZero* etc. I think parsing to and from numbers in FromLua and IntoLua without retaining these types' special property should be valid for most use cases, since it's crossing language boundaries.

Activity

  1. cheesycod commented on Oct 29, 2024

    @cheesycod

    @mintlu8 is this not possible already with mlua's serde ext

  2. lenscas commented on Oct 30, 2026

    @lenscas

    I run into missing NonZero (and NonZero*) quite often in my current project. The behavior described by mintlu8 would be more than good enough.

    The suggestion made by cheesycod doesn't work for me as I use quite a few macros and other wrapping traits/types to offer new niecities and reduce boilerplate, but those rely a lot on IntoLua/FromLua so the serde ext doesn't work for me.

    Right now, I made a macro_rules! macro that makes it easy to create mlua compatible wrapper for NonZeru* types but having proper support would be a lot nicer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions