1*6b4e7a29SLoGin #![allow(dead_code)] 2*6b4e7a29SLoGin use super::Attribute; 3*6b4e7a29SLoGin 4*6b4e7a29SLoGin #[derive(Debug)] 5*6b4e7a29SLoGin pub struct SysKernFilePriv { 6*6b4e7a29SLoGin attribute: Option<&'static dyn Attribute>, 7*6b4e7a29SLoGin // todo: 增加bin attribute,它和attribute二选一,只能有一个为Some 8*6b4e7a29SLoGin } 9*6b4e7a29SLoGin 10*6b4e7a29SLoGin impl SysKernFilePriv { 11*6b4e7a29SLoGin pub fn new(attribute: Option<&'static dyn Attribute>) -> Self { 12*6b4e7a29SLoGin if attribute.is_none() { 13*6b4e7a29SLoGin panic!("attribute can't be None"); 14*6b4e7a29SLoGin } 15*6b4e7a29SLoGin return Self { attribute }; 16*6b4e7a29SLoGin } 17*6b4e7a29SLoGin 18*6b4e7a29SLoGin pub fn attribute(&self) -> Option<&'static dyn Attribute> { 19*6b4e7a29SLoGin self.attribute 20*6b4e7a29SLoGin } 21*6b4e7a29SLoGin } 22