Skip to content

Commit 43faa3c

Browse files
committed
build: import basic implementation
Import build-system related files as well as the basic str16 implementation. This is still largely based on the code from Tom, but changed to stay more closely to what CStr/CString does in libstd. Signed-off-by: David Rheinsberg <david.rheinsberg@gmail.com>
1 parent 75d1865 commit 43faa3c

File tree

6 files changed

+542
-0
lines changed

6 files changed

+542
-0
lines changed

.travis.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
os: linux
2+
dist: xenial
3+
sudo: false
4+
language: rust
5+
cache: cargo
6+
7+
rust:
8+
- stable
9+
- nightly
10+
11+
script:
12+
- cargo build --verbose --all-targets
13+
- cargo test --verbose

AUTHORS

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
LICENSE:
2+
This project is dual-licensed under both the Apache License, Version
3+
2.0, and the GNU Lesser General Public License, Version 2.1+.
4+
5+
AUTHORS-ASL:
6+
Licensed under the Apache License, Version 2.0 (the "License");
7+
you may not use this file except in compliance with the License.
8+
You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS,
14+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
See the License for the specific language governing permissions and
16+
limitations under the License.
17+
18+
AUTHORS-LGPL:
19+
This program is free software; you can redistribute it and/or modify it
20+
under the terms of the GNU Lesser General Public License as published
21+
by the Free Software Foundation; either version 2.1 of the License, or
22+
(at your option) any later version.
23+
24+
This program is distributed in the hope that it will be useful, but
25+
WITHOUT ANY WARRANTY; without even the implied warranty of
26+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27+
Lesser General Public License for more details.
28+
29+
You should have received a copy of the GNU Lesser General Public License
30+
along with this program; If not, see <http://www.gnu.org/licenses/>.
31+
32+
COPYRIGHT: (ordered alphabetically)
33+
Copyright (C) 2018-2019 Red Hat, Inc.
34+
35+
AUTHORS: (ordered alphabetically)
36+
David Rheinsberg <david.rheinsberg@gmail.com>
37+
Tom Gundersen <teg@jklm.no>

Cargo.toml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
[package]
2+
name = "r-efi-string"
3+
version = "0.1.0"
4+
5+
authors = [
6+
"David Rheinsberg <david.rheinsberg@gmail.com>",
7+
"Tom Gundersen <teg@jklm.no>",
8+
]
9+
categories = [
10+
"embedded",
11+
"hardware-support",
12+
"no-std",
13+
"os",
14+
]
15+
description = "UEFI String Types and Converters"
16+
edition = "2018"
17+
homepage = "https://r-util.github.com/r-efi"
18+
keywords = [
19+
"efi",
20+
"firmware",
21+
"string",
22+
"uefi",
23+
"unicode",
24+
]
25+
license = "Apache-2.0 OR LGPL-2.1-or-later"
26+
readme = "README.md"
27+
repository = "https://github.com/r-util/r-efi-string"

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
r-efi-string
2+
============
3+
4+
UEFI String Types and Converters
5+
6+
The r-efi-string project implements string types according to the Unicode
7+
strings described in the UEFI specification, as well as converters to/from
8+
common rust types. The UEFI specification defines several different string
9+
types. The most common one is UCS-2 based, but neither follows a strict UCS-2
10+
nor UTF-16 standard. Furthermore, it defines a UTF-8 based string as well as an
11+
ISO-8859-1 based string.
12+
13+
### Project
14+
15+
* **Website**: <https://r-util.github.io/r-efi>
16+
* **Bug Tracker**: <https://github.com/r-util/r-efi-string/issues>
17+
18+
### Requirements
19+
20+
The requirements for this project are:
21+
22+
* `rustc >= 1.31.0`
23+
24+
### Build
25+
26+
To build this project, run:
27+
28+
```sh
29+
cargo build
30+
```
31+
32+
### Repository:
33+
34+
- **web**: <https://github.com/r-util/r-efi-string>
35+
- **https**: `https://github.com/r-util/r-efi-string.git`
36+
- **ssh**: `git@github.com:r-util/r-efi-string.git`
37+
38+
### License:
39+
40+
- **Apache-2.0** OR **LGPL-2.1-or-later**
41+
- See AUTHORS file for details.

src/lib.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
//! UEFI String Types and Converters
2+
//!
3+
//! This projects implements string types for the different string encodings used on UEFI systems.
4+
//! While the types are rather specific to UEFI, this project does **not** depend on any UEFI
5+
//! headers or protocols, but is a stand-alone implementation.
6+
//!
7+
//! See the different modules for the types provided:
8+
//!
9+
//! * `[str16]`: UCS-2 based strings, which use a `u16` based encoding.
10+
11+
// We currently need some unstable features:
12+
//
13+
// * We import `liballoc` since we want to explicitly allow running in no-std environments with
14+
// custom allocators.
15+
//
16+
// * We use `doc_cfg` to run conditional code in rustdoc compilations. This is, again, related to
17+
// `no_std`, since we want to make sure the rustdoc examples still work correctly.
18+
#![feature(alloc, doc_cfg)]
19+
20+
// We do not depend on `libstd`, but pull it in for our unit tests and documentation.
21+
#![cfg_attr(not(any(test, rustdoc)), no_std)]
22+
23+
// We provide converters to/from `alloc::string::String`, so import `liballoc`.
24+
extern crate alloc;
25+
26+
pub mod str16;

0 commit comments

Comments
 (0)