// this would not compile if STRING were not marked #[derive(Debug)]
assert_eq!(format!("{:?}", STRING), "STRING { __private_field: () }".to_string());
}
mod visibility {
lazy_static! { pubstaticref FOO: Box<u32> = Box::new(0); staticref BAR: Box<u32> = Box::new(98);
}
// This should not cause a warning about a missing Copy implementation
lazy_static! { pubstaticref VAR: i32 = { 0 };
}
#[derive(Copy, Clone, Debug, PartialEq)] struct X; struct Once(X); const ONCE_INIT: Once = Once(X); static DATA: X = X; static ONCE: X = X; fn require_sync() -> X { X } fn transmute() -> X { X } fn __static_ref_initialize() -> X { X } fn test(_: Vec<X>) -> X { X }
// All these names should not be shadowed
lazy_static! { staticref ITEM_NAME_TEST: X = {
test(vec![X, Once(X).0, ONCE_INIT.0, DATA, ONCE,
require_sync(), transmute(), // Except this, which will sadly be shadowed by internals: // __static_ref_initialize()
])
};
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.