Fix return type for CollectionRef::new
gir doesn't seem to generate this correctly. I have no clue why, there are certainly some functions where nullable=1 causes an Option return.
This commit is contained in:
parent
8bfefa2b14
commit
8561eaaa8c
|
|
@ -917,7 +917,7 @@ indicating a ref name which is not globally unique.</doc>
|
||||||
@collection_id is %NULL, this is equivalent to a plain ref name string (not a
|
@collection_id is %NULL, this is equivalent to a plain ref name string (not a
|
||||||
refspec; no remote name is included), which can be used for non-P2P
|
refspec; no remote name is included), which can be used for non-P2P
|
||||||
operations.</doc>
|
operations.</doc>
|
||||||
<return-value transfer-ownership="full">
|
<return-value transfer-ownership="full" nullable="1">
|
||||||
<doc xml:space="preserve">a new #OstreeCollectionRef</doc>
|
<doc xml:space="preserve">a new #OstreeCollectionRef</doc>
|
||||||
<type name="CollectionRef" c:type="OstreeCollectionRef*"/>
|
<type name="CollectionRef" c:type="OstreeCollectionRef*"/>
|
||||||
</return-value>
|
</return-value>
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ glib_wrapper! {
|
||||||
|
|
||||||
impl CollectionRef {
|
impl CollectionRef {
|
||||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||||
pub fn new<'a, P: Into<Option<&'a str>>>(collection_id: P, ref_name: &str) -> CollectionRef {
|
// CHANGE: return type CollectionRef to Option<CollectionRef>
|
||||||
|
pub fn new<'a, P: Into<Option<&'a str>>>(collection_id: P, ref_name: &str) -> Option<CollectionRef> {
|
||||||
let collection_id = collection_id.into();
|
let collection_id = collection_id.into();
|
||||||
let collection_id = collection_id.to_glib_none();
|
let collection_id = collection_id.to_glib_none();
|
||||||
unsafe {
|
unsafe {
|
||||||
|
|
@ -60,3 +61,6 @@ impl hash::Hash for CollectionRef {
|
||||||
hash::Hash::hash(&self.hash(), state)
|
hash::Hash::hash(&self.hash(), state)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
mod tests;
|
||||||
Loading…
Reference in New Issue