[oden] Remove magic

This commit is contained in:
John Doty 2023-06-22 05:15:59 -07:00
parent e36ab17235
commit fd7e19e529

View file

@ -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,