https://www.iotworldtoday.com/wp-content/themes/ioti_child/assets/images/logo/footer-logo.png
  • Home
  • News
    • Back
    • IoT World 2020 News
  • Strategy
  • Special Reports
  • Galleries
  • Business Resources
    • Back
    • Webinars
    • White Papers
    • Industry Perspectives
    • Featured Vendors
  • Other Content
    • Back
    • IoT World 2020 News
    • Q&As
    • Case Studies
    • Features
    • How-to
    • Opinion
    • Video / Podcasts
  • More
    • Back
    • About Us
    • Contact
    • Advertise
    • Strategic Partners
  • IOT World Events
    • Back
    • Internet of Things World: San Jose
    • IoT World 2020 News
Iot World Today
  • NEWSLETTER
  • Home
  • News
    • Back
    • IoT World 2020 News
  • Strategy
  • Special Reports
  • Galleries
  • Business Resources
    • Back
    • Webinars
    • White Papers
    • Industry Perspectives
    • Featured Vendors
  • Other Content
    • Back
    • IoT World 2020 News
    • Q&As
    • Case Studies
    • Features
    • How-to
    • Opinion
    • Video / Podcasts
  • More
    • Back
    • About Us
    • Contact
    • Advertise
    • Strategic Partners
  • IOT World Events
    • Back
    • Internet of Things World: San Jose
    • IoT World 2020 News
  • newsletter
  • IIoT
  • Cities
  • Energy
  • Homes/Buildings
  • Transportation/Logistics
  • Connected Health Care
  • Retail
  • AI
  • Architecture
  • Engineering/Development
  • Security
ioti.com

Embedded Computing


Thinkstock

Training and Development on the Mechanism of Metal Gears. in the design of information related to business

Developing IoT Applications with Rust: Using a Rust Development Environment

Developing for IoT with Rust has matured to the point that its ecosystem now includes an array of key support tools. One tool is Cargo.
  • Written by Dan Sullivan
  • 24th February 2021

Developers are most productive when they have tools to support all aspects of the software development cycle.

This includes programming languages, library and package managers, and testing and deployment tools. The Rust programming language has matured to the point that its ecosystem now includes an array of key support tools. One of these tools is Cargo.

Cargo is a package manager that supports all the core tasks of package management in both binary and library form. Cargo handles a lot of tasks, such as building your code, downloading the libraries your code depends on, and building those libraries, or dependencies.

Once Rust is installed, you canuse Cargo’s from the command line. Cargo commands are intuitive to the point of being obvious. For example, the cargonew’ command instructs Cargo to create a new package, which includes a directory structure for the package and a specification for the package, which is called a manifest. The manifest will contain metadata used by the Rust compiler.

Application code often has dependencies on other libraries and artifacts.  When a Rust application has dependencies, Cargo can get those dependencies during the build process. Not surprisingly, to build a package, we use the ‘rustc’ command, to call the Rust compiler.

Cargo observes conventions regarding package directory structure. Subdirectories include src (for source code), benches (for benchmark code) and tests (for integration test). The default executable file is src/main.rs. However, you can find other binaries in /src/bin/.

Cargo’s configuration metadata is defined in Cargo.toml and will be created and maintained manually. Another metadata file, Cargo.lock, contains metadata about dependencies. Unlike Cargo.toml, Cargo.lock is

maintained by Cargo and won’t be edited by developers. Configuration data is specified in TOML format, which is designed to have obvious semantics.

Cargo.toml contains sections describing the package, dependencies and features. The package section includes name, version, authors, path to build script, and license information. The dependencies section holds package dependencies, test dependencies, and build dependencies. Lastly, the features section specifies conditional compilation conditions, which is useful when working with multiple environments that need different configurations.

Developers can specify integration tests and run those tests using the ‘cargo test’ command. It’s common practice to use both unit tests and integration tests. Unit tests are designed to test one component or application function at a time, while integration tests will test the application in ways similar to how the application will be used in production. By convention, Rust expects to find tests in the tests subdirectory of a package. Each file in the tests subdirectory is compiled as a separate crate.

Often, developers will re-use common functions across tests and this is easily done with Rust. Developers can create public functions in modules and then import them into tests.

When looking at the organization of a Rust application, there are multiple levels of structure. The lowest level is the function, common across programming languages. Modules are different related functions grouped into a single file. Crates, the next level up, contain modules and, as noted earlier, are the unit of compilation. The last organizational unit is workspaces. These are used to organize multiple crates in the same application.

Rust extends the advantages of this modular application structure beyond just what one developer creates. The Crates.io site contains tens of thousands of crates that are available for use. There are widely used crates for common functional requirements, like generating random numbers, logging, and parsing command line arguments.  In addition, there are many specialized crates, including ones for IoT application development. There will be more specifics on those IoT crates in the next article of this series.

 

 

 

Tags: IoT platforms Developers Architecture Technologies

Related


  • IoT Cybersecurity Act Places Security Onus on Device Makers
    IoT device makers and builders need to start securing devices now as the wider builder community is expected to adopt the guidance from the IoT Cybersecurity Act.
  • Cisco Enlists Networking Automation, CX Cloud in COVID-19 Response
    At Cisco Live, the networking giant demonstrated how networking automation and cloud technologies have become key to pandemic response efforts.
  • How Industrial Edge Fuels Real-Time IoT Processes
    IoT processes such as product quality control, have gained new life at the industrial edge for real-time data and response.
  • Why eSIM matters for the IoT, and how it’s different from Embedded SIM
    By Tobias Goebel, Principal Product Marketing Manager, Twilio IoT There is a new kid on the SIM block: the eSIM. But don’t confuse this with embedded SIMs! Oh and there’s eUICC, and 1FF, 2FF, and 3FF, too. And what is an MFF2? This post will help. Let’s dive right in! What is a SIM? A […]

Leave a comment Cancel reply

-or-

Log in with your IoT World Today account

Alternatively, post a comment by completing the form below:

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Related Content

  • Private LTE Market Projected to Grow to $13 Billion
  • Network Machine Learning Offers Refuge for Taxed Managers
  • Trends Continue to Push Processing to the Edge for AI
  • Tactics for Successfully Selling IoT Technologies

News

View all

Webex Collaboration Banks on Hybrid Workplace Model at Cisco Live 2021

2nd April 2021

Cisco Enlists Networking Automation, CX Cloud in COVID-19 Response

31st March 2021

White Papers

View all

Telehealth and COVID Infographic

30th March 2021

Medical Supply Chain Management with Smart Devices and Sensors

30th March 2021

Special Reports

View all

Cybersecurity Protection Increasingly Depends on Machine Learning

28th October 2020

Webinars

View all

Weber’s Journey: How a Top Grill Maker Serves Up Connected Cooking

25th February 2021

From Insights to Action: Best Practices for Implementing Connected Device Security

15th December 2020

Galleries

View all

Top IoT Trends to Watch in 2020

26th January 2020

Five of the Most Promising Digital Health Technologies

14th January 2020

Industry Perspectives

View all

IoT Spending Holds Firm — Tempered by Dose of ‘IoT Pragmatism’

1st December 2020

The Great IoT Connectivity Lockdown

11th May 2020

Events

View all

Embedded IoT World 2021

28th April 2021 - 29th April 2021

The Virtual Industrial AI Summit

29th June 2021 - 30th June 2021

IoT World 2021

2nd November 2021 - 4th November 2021

Twitter

IoTWorldToday, IoTWorldSeries

🥳Happy #IoTDay! How are you celebrating? We're giving $50 off All Access Passes to join our upcoming virtual event,… twitter.com/i/web/status/1…

9th April 2021
IoTWorldToday, IoTWorldSeries

🎉 Announcing #EIOTWORLD sponsor, @InnoPhaseinc — a fabless wireless semiconductor platform company specializing in… twitter.com/i/web/status/1…

8th April 2021
IoTWorldToday, IoTWorldSeries

Digital Health Infrastructure Benefits From Cloud-to-Edge Architecture dlvr.it/RxBwQ4 https://t.co/AILVdUVWDA

7th April 2021
IoTWorldToday, IoTWorldSeries

Meet the #EIOTWORLD keynote lineup: Google, Facebook, Linux Foundation, STMicroelectronics, Antmicro, OpenHW Group,… twitter.com/i/web/status/1…

6th April 2021
IoTWorldToday, IoTWorldSeries

Network Data Analytics Supports Back-to-Work Health and Safety dlvr.it/Rx5xlL https://t.co/VvxxpdUMJ3

6th April 2021
IoTWorldToday, IoTWorldSeries

IoT Cybersecurity Act Places Security Onus on Device Makers dlvr.it/Rx2jHK https://t.co/fyd3nQ1r1Z

5th April 2021

Newsletter

Sign up for IoT World Today newsletters: vertical industry coverage on Tuesdays and horizontal tech coverage on Thursdays.

Special Reports

Our Special Reports take an in-depth look at key topics within the IoT space. Download our latest reports.

Business Resources

Find the latest white papers and other resources from selected vendors.

Media Kit and Advertising

Want to reach our audience? Access our media kit.

DISCOVER MORE FROM INFORMA TECH

  • IoT World Series
  • Channel Futures
  • RISC-V
  • Dark Reading
  • ITPro Today
  • Web Hosting Talk

WORKING WITH US

  • Contact
  • About Us
  • Advertise
  • Login/Register

FOLLOW IoT World Today ON SOCIAL

  • Privacy
  • CCPA: “Do Not Sell My Data”
  • Cookies Policy
  • Terms
Copyright © 2021 Informa PLC. Informa PLC is registered in England and Wales with company number 8860726 whose registered and Head office is 5 Howick Place, London, SW1P 1WG.
This website uses cookies, including third party ones, to allow for analysis of how people use our website in order to improve your experience and our services. By continuing to use our website, you agree to the use of such cookies. Click here for more information on our Cookie Policy and Privacy Policy.
X