[oden] Remove magic
This commit is contained in:
parent
e36ab17235
commit
fd7e19e529
1 changed files with 1 additions and 9 deletions
|
|
@ -16,23 +16,16 @@ pub enum GraphicsCommand {
|
||||||
EndFrame,
|
EndFrame,
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAGIC_VALUE: u64 = 0xABCDB00BABCDBEEB;
|
|
||||||
|
|
||||||
struct GraphicsImpl {
|
struct GraphicsImpl {
|
||||||
magic: u64,
|
|
||||||
sender: Sender<GraphicsCommand>,
|
sender: Sender<GraphicsCommand>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GraphicsImpl {
|
impl GraphicsImpl {
|
||||||
pub fn new(sender: Sender<GraphicsCommand>) -> Self {
|
pub fn new(sender: Sender<GraphicsCommand>) -> Self {
|
||||||
GraphicsImpl {
|
GraphicsImpl { sender }
|
||||||
magic: MAGIC_VALUE,
|
|
||||||
sender,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_fn(&self, ctx: &ContextRef, args: &[&ValueRef]) -> ValueResult {
|
fn print_fn(&self, ctx: &ContextRef, args: &[&ValueRef]) -> ValueResult {
|
||||||
assert_eq!(self.magic, MAGIC_VALUE);
|
|
||||||
let mut text = String::with_capacity(128);
|
let mut text = String::with_capacity(128);
|
||||||
for arg in args {
|
for arg in args {
|
||||||
let v = arg.to_string(ctx)?;
|
let v = arg.to_string(ctx)?;
|
||||||
|
|
@ -47,7 +40,6 @@ impl GraphicsImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn cls_fn(&self, ctx: &ContextRef, args: &[&ValueRef]) -> ValueResult {
|
fn cls_fn(&self, ctx: &ContextRef, args: &[&ValueRef]) -> ValueResult {
|
||||||
assert_eq!(self.magic, MAGIC_VALUE);
|
|
||||||
if args.len() != 3 {
|
if args.len() != 3 {
|
||||||
return Err(Error::ArgumentCountMismatch {
|
return Err(Error::ArgumentCountMismatch {
|
||||||
expected: 3,
|
expected: 3,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue