rust-embed | Rust Macro which loads files

 by   pyros2097 Rust Version: Current License: MIT

kandi X-RAY | rust-embed Summary

kandi X-RAY | rust-embed Summary

rust-embed is a Rust library typically used in Embedded System applications. rust-embed has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

Rust Custom Derive Macro which loads files into the rust binary at compile time during release and loads the file from the fs during dev. You can use this to embed your css, js and images into a single executable which can be deployed to your servers. Also it makes it easy to build a very small docker image for you to deploy.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              rust-embed has a low active ecosystem.
              It has 715 star(s) with 45 fork(s). There are 10 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 2 open issues and 67 have been closed. On average issues are closed in 72 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of rust-embed is current.

            kandi-Quality Quality

              rust-embed has no bugs reported.

            kandi-Security Security

              rust-embed has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              rust-embed is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              rust-embed releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rust-embed
            Get all kandi verified functions for this library.

            rust-embed Key Features

            No Key Features are available at this moment for rust-embed.

            rust-embed Examples and Code Snippets

            No Code Snippets are available at this moment for rust-embed.

            Community Discussions

            QUESTION

            Rust custom bare metal compile target: linker expects "_start" symbol and discards unused ones: How can I specify a custom entry symbol?
            Asked 2021-Jun-10 at 12:17

            I'm cross compiling bare metal 32-bit code for x86 with Rust and I'm facing the problem, that the final object file is empty, if the entry function is not exactly called _start; the linker throws all code away because it sees it as dead. I'm familiar with the fact, that _start is a well-known entry point name, but the question is still:

            What part in Rust, LLVM or Linker forces this? Also attributes like extern "C" fn ..., #[no_mangle] or #[export_name = "foobar"] do not work (get thrown away by the linker). My guess is, that it's not the Rust compiler but the linker. As you can see, I use rust-lld as linker and ld.lld as linker-flavor in my case (see below).

            1. Where does the required _start-come from? Why does the linker throw my other code away?
            2. Whats the best option to specify my custom entry point to the linker?

            x86-unknown-bare_metal.json

            ...

            ANSWER

            Answered 2021-Jun-10 at 12:17

            New Answer [Solution]

            The real solution is quite simple but was hard to find, because it's hard to digg for possible options and solutions in this relatively undocumented field. I found out, that llvm-ld uses the same options, as GNU ld. So I checked against the GNU ld link options and found the solution. It has to be

            Source https://stackoverflow.com/questions/67918256

            QUESTION

            Using Rust crates for an STM32 microcontroller board
            Asked 2021-May-29 at 19:34

            I'm currently trying to learn Rust (for embedded specifically), coming from a background of C for embedded systems and Python. So far, I've been reading Rust Programming Language and Rust for Embedded, and read a few blog posts on the web.

            I want my first project to be a simple "Blinky", where an LED blinks infinitely. I've got an STM32L152CDISCOVERY board with an STM32L152 chip in it (basically same as STM32L151), which is a Cortex M3.

            Instead of implementing everything from scratch, I want to leverage existing crates and HALs. I've found two that seem promising: stm32l1 and stm32l1xx-hal. I've tried to read the documentation of each of them and also part of the source code, but I still can't figure out how to use them correctly.

            Got a few questions about Rust and about the crates:

            1. I see that stm32l1xx-hal has a dependency on stm32l1. Do I need to add both as a dependency in my Cargo.toml file? Or will that create problems related to ownership?

            2. Is this the correct way to add them? Why is the second one added like that [dependencies.stm32l1]?

              ...

            ANSWER

            Answered 2021-May-29 at 19:32

            I got some help from a Discord community. The answers were (modified a bit by me):

            1. stm32l1xx-hal already depends on stm32l1 as seen here. There's no need to import it twice. It is enough to add to Cargo.toml:

            Source https://stackoverflow.com/questions/67654351

            QUESTION

            Where are Rust's built in target specifications defined?
            Asked 2021-Mar-29 at 13:07

            The built in targets that Rust supports have target specifications that can be printed as described here. You can add more targets using a JSON file, but I can't find any JSON files for the existing targets.

            Where are the built in target specifications found in the Rust source code?

            ...

            ANSWER

            Answered 2021-Mar-29 at 13:07

            The builtin targets are not defined as JSON (because there's no reason to and that would just slow down the compiler for no reason): https://github.com/rust-lang/rust/tree/master/compiler/rustc_target/src/spec

            You can actually find that information in the rustc devguide, in the "Adding a new target" page.

            As that document shows, you can also ask rustc to export an existing target as JSON:

            Source https://stackoverflow.com/questions/66845716

            QUESTION

            sin(), cos(), log10() (float) not found for target thumbv7em-none-eabihf
            Asked 2021-Mar-28 at 10:41

            I'm using Rust 1.51 and this minimal crate:

            ...

            ANSWER

            Answered 2021-Mar-28 at 10:41

            In Rust 1.51 (and below) functions like sin, cos, or log10 are not part of the core library (core::) but only the standard library (std::), therefore they are not available.

            A practical solution is to use the crate libm which offers typical mathematic functions for no_std-environments.

            Source https://stackoverflow.com/questions/66840114

            QUESTION

            rust msp430 linker error - .text is not within region ROM
            Asked 2021-Mar-26 at 09:21

            I am working on an embedded rust project using msp430 controllers (MSP430G2553 - LaunchPad).

            I have boilerplate code up and running from the msp430 quickstart repo

            However, for my project, I need to run hmac, so I found a no_std compatible crate. I have tried roughly 10 other crates as well without luck.

            I believe I need to specify some flags for the linker, but I do not know which I am missing. I currently have rust the following rustflag set in .cargo/config:

            ...

            ANSWER

            Answered 2021-Mar-17 at 13:05

            It seems that you are linking to the wrong memory spec file. I would recommend to ensure that this file exists link-arg=-Tlink.x, otherwise switch it to the correct file.

            Rust embedded named their memory file memory.x, and I assume have followed the steps. So changing the flag to link-arg=-Tmemory.xshould fix it.

            Source https://stackoverflow.com/questions/66669150

            QUESTION

            Is it possible to see feature documentation on docs.rs?
            Asked 2021-Mar-08 at 20:54

            I'm looking at the documentation for gpio_cdev on docs.rs.

            One of the optional features for that crate is async-tokio, which allows you to write async code to check GPIO pins. There is an example of this on the gpio_cdev github front page using AsyncLineEventHandle.

            The problem I'm seeing is that the docs.rs documentation has absolutely no mention of AsyncLineEventHandle, or anything to do with Async.

            Is there a button on the docs.rs website to show documentation for optional features? Are optional features never documented on docs.rs? Or is this up to the developer to include the documentation for optional features on docs.rs? Should I be filing a bug report for this?

            I assume I'm able to see the documentation if I locally generate it using cargo doc (though I haven't tried this). Is this the only option?

            Edit: Confirmed that as long as I have the feature enabled, locally generating docs does show the async parts.

            ...

            ANSWER

            Answered 2021-Mar-08 at 01:08

            Documentation in docs.rs is built ahead of time. It isn't generated on the fly. Because of this, there isn't a button.

            Features being on or off during documentation building will depend on the crate author to specify that the feature be used and on for document compilation in docs.rs. Take a look at the Cross-compiling section on the About/Builds page and perhaps maybe send in a PR to gpio_cdev to turn on all the features during documentation build in docs.rs?

            Source https://stackoverflow.com/questions/66519446

            QUESTION

            How to Use RustEmbed to load Images into an fltk app?
            Asked 2021-Mar-06 at 18:39

            I'm trying to use the RustEmbed crate to embed some svg icons into my executable. I don't see any documentation on how to turn the data returned from Asset::get("icons/some.svg") into an actual image. My GUI library is fltk, and I want to create an fltk::image::SvgImage using Asset but SvgImage::new() loads an svg from a path, not raw byte data. Because it loads the svg from a path and not from raw byte data, does that mean I can't use RustEmbed for embedding the icons into my target build?

            I want to do this because I feel like embedding my image assets into the executable will help avoid IO errors when the path of my executable is changed during deployment/install/build. I thought this one of the intentions of the RustEmbed crate.

            ...

            ANSWER

            Answered 2021-Mar-06 at 18:39

            Turns out that fltk::image::SvgImage has a from_data() function. This can be used create load the svg from byte data:

            Source https://stackoverflow.com/questions/66502590

            QUESTION

            Embedded Rust Discovery Book example fails to compile
            Asked 2021-Mar-01 at 13:49

            I am new to rust and embedded systems. I was reading and going along "The Discovery Book" and I can't seem to figure out the errors below.

            I have placed this in my main.rs:

            ...

            ANSWER

            Answered 2021-Mar-01 at 13:14

            From the following page, "The Led and Delay abstractions", it looks like this is the set of imports that you need.

            Source https://stackoverflow.com/questions/66421522

            QUESTION

            Gdb: target remote connects at the wrong place?
            Asked 2021-Jan-15 at 16:39

            I'm learning how to use OpenOCD and GDB according to the Rust Embedded Book.

            There is a moment when you connect to the running OpenOCD:

            ...

            ANSWER

            Answered 2021-Jan-15 at 16:39

            When you connect to the target with target remote GDB asks the target for its current register state, including the $pc value. GDB does NOT (at that point) modify the remote state in any way.

            When you first connected the remote reported a $pc value of 0x0. If the remote changed state for some reason, lets say, you ran something on the remote, then the $pc value might change, say to 0x08000bbe.

            If you then disconnect and reconnect the remote target might still have a $pc value of 0x08000bbe which is what GDB will see.

            As was mentioned in the comments, GDB is just trying to map the $pc value onto the debug information in your program. The ?? shows that GDB can't find any symbols at address 0x0. While GDB did find the symbol __c_m_sh_syscall near to address 0x08000bbe. However, this is information doesn't mean much at this point, you've not yet loaded anything onto the target, so you're not really in the function __c_m_sh_syscall, it's just the current address of the remote.

            When you do the load command this is when GDB loads the executable onto the target, and writes to the $pc.

            TL;DR; If your work flow is target remote then load, don't worry about the state of the target immediately after the target remote, this is just whatever random state happens to be in the target when you connect.

            Source https://stackoverflow.com/questions/65738714

            QUESTION

            Why am I getting a VFP register arguments while adding a custom target to rust (arm-unknown-linux-uclibceabihf)?
            Asked 2020-Oct-31 at 13:48

            I am following the guide from the last rust newsletter: https://rust-embedded.github.io/embedonomicon/custom-target.html and encounter an issue related to soft/hard float configuration.

            I created my new target by merging the mipsel-unknown-linux-uclibc.json with the arm-unknown-linux-gnueabihf.json to obtain the following result:

            ...

            ANSWER

            Answered 2020-Oct-31 at 13:48

            I believe you just need to use arm-unknown-linux-gnueabihf for the llvm-target. The VFP error is related to the floating-point instruction set available (i.e. the hf in eabihf stands for Hard Float). I'm working on getting the armv7-unknown-linux-uclibceabihf target working in rust. I received the same VFP error while getting the armv7-unknown-linux-uclibceabihf target to work in rust and it turned out I just needed to use armv7-unknown-linux-gnueabihf for the llvm-target.

            Also, here's my spec file for armv7-unknown-linux-uclibceabihf for comparison:

            Source https://stackoverflow.com/questions/62936931

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install rust-embed

            You can download it from GitHub.
            Rust is installed and managed by the rustup tool. Rust has a 6-week rapid release process and supports a great number of platforms, so there are many builds of Rust available at any time. Please refer rust-lang.org for more information.

            Support

            You need to add the custom derive macro RustEmbed to your struct with an attribute folder which is the path to your static folder.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/pyros2097/rust-embed.git

          • CLI

            gh repo clone pyros2097/rust-embed

          • sshUrl

            git@github.com:pyros2097/rust-embed.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link

            Explore Related Topics

            Consider Popular Rust Libraries

            996.ICU

            by 996icu

            deno

            by denoland

            rust

            by rust-lang

            alacritty

            by alacritty

            tauri

            by tauri-apps

            Try Top Libraries by pyros2097

            gdx-studio

            by pyros2097Java

            GdxStudio

            by pyros2097Java

            go-embed

            by pyros2097Go

            Scene3d

            by pyros2097Java

            Sink

            by pyros2097Java