rust/hg-cpython/src/dirstate/dirstate_map.rs
changeset 43482 8418b77132c1
parent 43474 b9f791090211
child 43808 1fe2e574616e
equal deleted inserted replaced
43481:75b4eb98ad97 43482:8418b77132c1
   302             )),
   302             )),
   303         }
   303         }
   304     }
   304     }
   305 
   305 
   306     def keys(&self) -> PyResult<DirstateMapKeysIterator> {
   306     def keys(&self) -> PyResult<DirstateMapKeysIterator> {
   307         let leaked_ref = self.inner_shared(py).leak_immutable()?;
   307         let leaked_ref = self.inner_shared(py).leak_immutable();
   308         DirstateMapKeysIterator::from_inner(
   308         DirstateMapKeysIterator::from_inner(
   309             py,
   309             py,
   310             unsafe { leaked_ref.map(py, |o| o.iter()) },
   310             unsafe { leaked_ref.map(py, |o| o.iter()) },
   311         )
   311         )
   312     }
   312     }
   313 
   313 
   314     def items(&self) -> PyResult<DirstateMapItemsIterator> {
   314     def items(&self) -> PyResult<DirstateMapItemsIterator> {
   315         let leaked_ref = self.inner_shared(py).leak_immutable()?;
   315         let leaked_ref = self.inner_shared(py).leak_immutable();
   316         DirstateMapItemsIterator::from_inner(
   316         DirstateMapItemsIterator::from_inner(
   317             py,
   317             py,
   318             unsafe { leaked_ref.map(py, |o| o.iter()) },
   318             unsafe { leaked_ref.map(py, |o| o.iter()) },
   319         )
   319         )
   320     }
   320     }
   321 
   321 
   322     def __iter__(&self) -> PyResult<DirstateMapKeysIterator> {
   322     def __iter__(&self) -> PyResult<DirstateMapKeysIterator> {
   323         let leaked_ref = self.inner_shared(py).leak_immutable()?;
   323         let leaked_ref = self.inner_shared(py).leak_immutable();
   324         DirstateMapKeysIterator::from_inner(
   324         DirstateMapKeysIterator::from_inner(
   325             py,
   325             py,
   326             unsafe { leaked_ref.map(py, |o| o.iter()) },
   326             unsafe { leaked_ref.map(py, |o| o.iter()) },
   327         )
   327         )
   328     }
   328     }
   435             None => Ok(default),
   435             None => Ok(default),
   436         }
   436         }
   437     }
   437     }
   438 
   438 
   439     def copymapiter(&self) -> PyResult<CopyMapKeysIterator> {
   439     def copymapiter(&self) -> PyResult<CopyMapKeysIterator> {
   440         let leaked_ref = self.inner_shared(py).leak_immutable()?;
   440         let leaked_ref = self.inner_shared(py).leak_immutable();
   441         CopyMapKeysIterator::from_inner(
   441         CopyMapKeysIterator::from_inner(
   442             py,
   442             py,
   443             unsafe { leaked_ref.map(py, |o| o.copy_map.iter()) },
   443             unsafe { leaked_ref.map(py, |o| o.copy_map.iter()) },
   444         )
   444         )
   445     }
   445     }
   446 
   446 
   447     def copymapitemsiter(&self) -> PyResult<CopyMapItemsIterator> {
   447     def copymapitemsiter(&self) -> PyResult<CopyMapItemsIterator> {
   448         let leaked_ref = self.inner_shared(py).leak_immutable()?;
   448         let leaked_ref = self.inner_shared(py).leak_immutable();
   449         CopyMapItemsIterator::from_inner(
   449         CopyMapItemsIterator::from_inner(
   450             py,
   450             py,
   451             unsafe { leaked_ref.map(py, |o| o.copy_map.iter()) },
   451             unsafe { leaked_ref.map(py, |o| o.copy_map.iter()) },
   452         )
   452         )
   453     }
   453     }