rust-os | A simple OS written in Rust | Runtime Evironment library
kandi X-RAY | rust-os Summary
kandi X-RAY | rust-os Summary
A simple OS written in Rust
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rust-os
rust-os Key Features
rust-os Examples and Code Snippets
Community Discussions
Trending Discussions on rust-os
QUESTION
I am making a VGA print macro for my OS with no_std
, and it is for some reason not working. I am using the vga crate so that I do not have to do all the VGA code myself. I have a function called _print
:
ANSWER
Answered 2021-Mar-27 at 19:04Your code panics because as_str()
only returns Some
, if there is no arguments. So when you immediately unwrap()
it will panic, for instances where you have arguments to be formatted.
Get the formatted string, if it has no arguments to be formatted.
This can be used to avoid allocations in the most trivial case.
Instead you can use args.to_string()
instead of args.as_str().unwrap()
, to format it into a String
. So it actually formats regardless of whether there is any arguments or not.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install rust-os
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
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page