Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
rust-card10
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Astro
rust-card10
Commits
300024b8
Commit
300024b8
authored
5 years ago
by
rnd
Browse files
Options
Downloads
Patches
Plain Diff
[API] Provide a card10-alloc based global allocator as default feature.
parent
19f1c5a1
No related branches found
No related tags found
1 merge request
!19
[WIP] Task/card10 alloc
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Cargo.lock
+6
-1
6 additions, 1 deletion
Cargo.lock
Cargo.toml
+1
-0
1 addition, 0 deletions
Cargo.toml
card10-l0dable/Cargo.toml
+14
-1
14 additions, 1 deletion
card10-l0dable/Cargo.toml
card10-l0dable/src/lib.rs
+29
-0
29 additions, 0 deletions
card10-l0dable/src/lib.rs
with
50 additions
and
2 deletions
Cargo.lock
+
6
−
1
View file @
300024b8
...
...
@@ -77,10 +77,15 @@ name = "byteorder"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "card10-alloc"
version = "0.1.0"
[[package]]
name = "card10-l0dable"
version = "0.1.1"
dependencies = [
"card10-alloc 0.1.0",
"card10-sys 0.1.0",
]
...
...
@@ -181,8 +186,8 @@ dependencies = [
name = "l0dable-example"
version = "0.0.0"
dependencies = [
"card10-alloc 0.1.0",
"card10-l0dable 0.1.1",
"cc 1.0.37 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
...
...
This diff is collapsed.
Click to expand it.
Cargo.toml
+
1
−
0
View file @
300024b8
[workspace]
members
=
[
"card10-alloc"
,
"card10-sys"
,
"card10-l0dable"
,
"example"
,
...
...
This diff is collapsed.
Click to expand it.
card10-l0dable/Cargo.toml
+
14
−
1
View file @
300024b8
...
...
@@ -17,5 +17,18 @@ categories = ["no-std"]
description
=
"make l0dables for the Card10 (CCCamp 2019) badge"
[dependencies]
card10-sys
=
{
path
=
"../card10-sys"
,
version
=
"^0.1"
}
[dependencies.card10-sys]
path
=
"../card10-sys"
version
=
"^0.1"
[dependencies.card10-alloc]
path
=
"../card10-alloc"
version
=
"^0.1"
optional
=
true
[features]
default
=
[
"alloc"
]
# Provides an allocator to the dependent crate.
alloc
=
[
"card10-alloc"
]
This diff is collapsed.
Click to expand it.
card10-l0dable/src/lib.rs
+
29
−
0
View file @
300024b8
#![no_std]
#![feature(alloc_error_handler)]
mod
os
;
pub
use
os
::
*
;
mod
display
;
...
...
@@ -39,3 +41,30 @@ macro_rules! main {
}
};
}
// -----------------------------------------------------------------------------
// Allocation handling
// -----------------------------------------------------------------------------
/// Global Allocator Handling.
///
/// Contains only the minimal necessary definitions:
///
/// - static global allocator
/// - a proper allocation error handler
#[cfg(feature
=
"alloc"
)]
mod
alloc
{
pub
extern
crate
alloc
;
use
alloc
::
alloc
::
Layout
;
use
card10_alloc
::
Card10Allocator
;
#[global_allocator]
pub
static
ALLOCATOR
:
Card10Allocator
=
Card10Allocator
;
#[alloc_error_handler]
fn
error_handler
(
_layout
:
Layout
)
->
!
{
panic!
(
"OOM!"
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment