mkj / sunset

SSH for Rust, no_std and elsewhere
Other
34 stars 4 forks source link

example code #2

Open keredson opened 3 months ago

keredson commented 3 months ago

this could use an example for non-async, non-std.

i had to patch in a custom getrandom impl to use:

        #[path = "espidf.rs"] mod imp;

for some reason if #[cfg(target_os = "espidf")] wasn't true. this was in a new cargo generate esp-rs/esp-template.

beyond that, re the async example, depending on sunset-async seems to pull in stuff that depends on std. example:

error[E0463]: can't find crate for `alloc`
  --> /home/derek/.cargo/registry/src/index.crates.io-6f17d22bba15001f/futures-core-0.3.30/src/lib.rs:16:1
   |
16 | extern crate alloc;
   | ^^^^^^^^^^^^^^^^^^^ can't find crate
mkj commented 3 months ago

Yep, I'm keen to add an example for non-async, though I haven't actually tried using it that way myself yet. There might be API changes that could make it more ergonomic, though I think the basics are there for it to work.

Not sure about the target_os = "espidf" issue - sounds like cargo might be confused about targets? I haven't used esp-rs tools much.

At the moment sunset-async crate is intended for std async, and sunset-embassy is for no_std async. sunset-embassy should work with any executor/platform where there is an adequate RawMutex (not just Embassy), sunset-async depend on it for example. I've been thinking of renaming them to something clearer.

lasiotus commented 3 months ago

I would also love to see a non-async std example.

mkj commented 2 months ago

Are you more interested in a client or server non-async example?

lasiotus commented 2 months ago

I'm more interested in a server non-async std example, thanks!