mirror of https://github.com/astral-sh/ruff
ast::Int::to_usize
This commit is contained in:
parent
822cac5aa0
commit
d6b6df5d1c
|
|
@ -46,6 +46,9 @@ impl Int {
|
||||||
pub fn to_u32(&self) -> u32 {
|
pub fn to_u32(&self) -> u32 {
|
||||||
self.0
|
self.0
|
||||||
}
|
}
|
||||||
|
pub fn to_usize(&self) -> usize {
|
||||||
|
self.0 as _
|
||||||
|
}
|
||||||
pub fn to_bool(&self) -> bool {
|
pub fn to_bool(&self) -> bool {
|
||||||
self.0 > 0
|
self.0 > 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue