Git Product home page Git Product logo

spacepackets-rs's People

Contributors

linusjanek avatar robamu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

spacepackets-rs's Issues

Question about Panics in spacepackets-rs

Hello!

I've been quite interested in a rust implementation of spacepackets and have enjoyed using your project.

I have been grokking the codebase of the Rust spacepacket implementation and noticed the use of panics in the builder methods, specifically in the const_new and new functions of various structs. While I understand that panics are a part of Rust's error handling mechanism and can be useful for catching exceptional cases, I have concerns regarding their usage in these particular scenarios.

First, in the UnixTimestamp struct, the const_new function panics if the subsec_millis value exceeds 999. Similarly, in the PacketSequenceCtrl struct, both the const_new and new functions panic if the seq_count value exceeds MAX_SEQ_COUNT. Although panics can be appropriate for handling unexpected or invalid inputs, I'm unsure whether they are the best approach in these cases. I do understand for the latter example that these panic conditions are checked before calling, so they won't panic in those cases.

  • is this pattern, const_new and new, common for Rust 2021 projects? Would there be preferable ways to call const_new without requiring the caller to check the panic conditions?
  • what is the rationale for checking subsec_millis greater than 999? Would there be cases where the value may be user-specified?

Thank you,

Ethan

Consider Interface extension TimeProvider::from_now_with_u16/24_days()

Given the timeprovider example:

let timestamp_now = TimeProvider::from_now_with_u16_days().unwrap();

One could extend the interface of ::from_now_with_u16/24_days() with an optional argument to enable little vs big endianness. Doing this manually on the ouput bytes would be rather cumbersome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.