Skip to content

Add support for u64 numbers? #532

@kairoswater-jason

Description

@kairoswater-jason

liquid-rust version: "0.26.4"
rust version: rustc 1.75.0 (82e1608df 2023-12-21)
OS: Ubuntu 22.04.3 LTS

Does liquid-rust support 64 bit unsigned integers? Should it?

Attempting to populate a template with an Option<u64> results in the following error "Cannot fit number"

Result::unwrap()on anErr` value: Error { inner: InnerError { msg: "Cannot fit number", user_backtrace: [Trace { trace: None, context: [] }], cause: None } }

But when the u64 is changed to u32, the error does not occur.

This error is triggered when calling liquid::to_object(&parameters).unwrap(); with a parameter struct that contains a u64. In this case &parameters is of the TemplateParameters type as defined below.

#[derive(Debug,Serialize,Clone)]
struct Field {
    name : String,
    typename : String,
    size : u8,
    start_index : u16,
    end_index : u16,
    value_override : Option<u64>
}

#[derive(Debug,Serialize,Clone)]
struct Message {
    name : String,
    fields : Vec<Field>,
    msg_type : MsgType,
    fport : u8,
    length : u8
}

#[derive(Serialize)]
struct TemplateParameters {
    name: String,
    all_messages: Vec<Message>,
    downlinks: Vec<Message>,
    uplinks: Vec<Message>
}

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