loony-bean / textplots-rs

Terminal plotting library for Rust
238 stars 24 forks source link

Made lib no-std #50

Open uandere opened 1 year ago

uandere commented 1 year ago

This pull request adds no_std functionality to the library. This allows for embedded development using textplots, although testing is needed to confirm this possibility.

This is done by introducing new drawille-nostd crate, which does not rely on standard library features. Now, when adding textplots to Cargo.toml dependencies with default-features = false, it will use drawille-nostd crate with reduced functionality (no color support):

# using no_std functionality
textplots = {version = "*", default-features = false}

By default, std feature is enabled, so you can also use all library's functionality like before, without any changes.

loony-bean commented 1 year ago

@Kezii @TDHolmes what do you guys think about this?

TDHolmes commented 1 year ago

This was discussed on #14 , how are you handling drawile-rs & colored? Those are std reliant dependencies aren't they?

uandere commented 1 year ago

This was discussed on #14 , how are you handling drawile-rs & colored? Those are std reliant dependencies aren't they?

Hi, @TDHolmes! I separated std and no_std functionality by providing new drawille-nostd crate. Now when adding textplots to Cargo.toml with default features (std feature enabled, no changes required), we're using drawille and colored. Otherwise, when default-features = false is specified, we're swithing to the functionality of the drawille-nostd crate.

What do you think about that?

TDHolmes commented 1 year ago

Sweet! Sounds good

On Sat, Oct 7, 2023 at 6:01 AM Nazar Demchuk @.***> wrote:

This was discussed on #14 https://github.com/loony-bean/textplots-rs/issues/14 , how are you handling drawile-rs & colored? Those are std reliant dependencies aren't they?

Hi, @TDHolmes https://github.com/TDHolmes! I separated std and no_std functionality by providing new drawille-nostd crate. Now when adding textplots to Cargo.toml with default features (std feature enabled, no changes required), we're using drawille and colored. Otherwise, when default-features = false is specified, we're swithing to the functionality of the drawille-nostd crate.

What do you think about that?

— Reply to this email directly, view it on GitHub https://github.com/loony-bean/textplots-rs/pull/50#issuecomment-1751707071, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5YNWR7TYKSJFAUN4EOKGLX6FHBVAVCNFSM6AAAAAA42LVWSOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONJRG4YDOMBXGE . You are receiving this because you were mentioned.Message ID: @.***>

uandere commented 1 year ago

Sweet! Sounds good

Thanks! Planning to test this out next week on stm32f4 =)