mirror of
https://github.com/RustPython/Parser.git
synced 2025-07-08 05:35:22 +00:00
ast::Int::to_usize
This commit is contained in:
parent
822cac5aa0
commit
d6b6df5d1c
1 changed files with 3 additions and 0 deletions
|
@ -46,6 +46,9 @@ impl Int {
|
|||
pub fn to_u32(&self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
pub fn to_usize(&self) -> usize {
|
||||
self.0 as _
|
||||
}
|
||||
pub fn to_bool(&self) -> bool {
|
||||
self.0 > 0
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue