One advantage of using `core::` is that code _could_ be used from
`no_std` environments. For example, it's somewhat common in the Rust
ecosystem to have a `no_std` feature in a library that, when turned on,
elides some functionality but retains whatever can operate in `no_std`.
-Amit
"'Johnathan Van Why' via Tock Embedded OS Development Discussion"
<
tock...@googlegroups.com> writes:
> In crates that are *not* #![no_std], should we refer to items in the core
> library via core:: or via std::? That is, do we refer to Cell as
> core::cell::Cell or std::cell::Cell?
>
> I've been haphazardly using a mix in libtock-rs' codebase, which has a lot
> of crates (mostly testing crates) that use the standard library. This feels
> like one of those "we should pick a rule and stick with it" things that
> belongs in the Tock Style
> <
https://github.com/tock/tock/blob/master/doc/Style.md> document.
>
> An advantage of using core:: is consistency with our #![no_std] crates
> (which is a majority of the tock/tock repository). An advantage of using
> std:: is consistency with the greater Rust ecosystem, most of which uses
> the standard library.
>
> Anyone have input on which name we should prefer? I personally prefer using
> core:: but I'm not strongly opinionated about it.
>
> -Johnathan
>
> --
> You received this message because you are subscribed to the Google Groups "Tock Embedded OS Development Discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
tock-dev+u...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/tock-dev/CAJqTQ1jVpDktHZhNyvyihX9koKnhetTQAO7sm_pHkq3pvMFVuQ%40mail.gmail.com.