Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for u64 numbers? #532

Open
kairoswater-jason opened this issue Jan 23, 2024 · 0 comments
Open

Add support for u64 numbers? #532

kairoswater-jason opened this issue Jan 23, 2024 · 0 comments

Comments

@kairoswater-jason
Copy link

kairoswater-jason commented Jan 23, 2024

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>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant