Trait glib::translate::FromGlibPtrBorrow [−][src]
pub trait FromGlibPtrBorrow<P: Ptr>: Sized { unsafe fn from_glib_borrow(_ptr: P) -> Borrowed<Self> { ... } }
Expand description
Translate from a pointer type by borrowing, without affecting the refcount.
The purpose of this trait is to access values inside callbacks without changing their reference status. The obtained borrow must not be accessed outside of the scope of the callback, and called procedures must not store any references to the underlying data. Safe Rust code must never obtain a mutable Rust reference.
Safety
The implementation of this trait as well as the returned type must satisfy the same constraints together. They must not take ownership of the underlying value, copy it, and should not change its rerefence count. If it does, it must properly release obtained references.
The returned value, when dropped, must leave the underlying value in the same state as before from_glib_borrow was called:
- it must not be dropped,
- it must be the same type of reference, e.g. still floating.
For more information, refer to module level documentation.
Provided methods
unsafe fn from_glib_borrow(_ptr: P) -> Borrowed<Self>
unsafe fn from_glib_borrow(_ptr: P) -> Borrowed<Self>
Safety
See trait level notes on safety
Implementations on Foreign Types
Implementors
impl FromGlibPtrBorrow<*mut cairo_t> for Context
impl FromGlibPtrBorrow<*mut cairo_t> for Context
impl FromGlibPtrBorrow<*mut cairo_device_t> for Device
impl FromGlibPtrBorrow<*mut cairo_device_t> for Device
impl FromGlibPtrBorrow<*mut cairo_surface_t> for ImageSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for ImageSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for RecordingSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for RecordingSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for Surface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for Surface
impl FromGlibPtrBorrow<*mut xcb_connection_t> for XCBConnection
impl FromGlibPtrBorrow<*mut xcb_connection_t> for XCBConnection
impl FromGlibPtrBorrow<*mut xcb_render_pictforminfo_t> for XCBRenderPictFormInfo
impl FromGlibPtrBorrow<*mut xcb_render_pictforminfo_t> for XCBRenderPictFormInfo
impl FromGlibPtrBorrow<*mut xcb_screen_t> for XCBScreen
impl FromGlibPtrBorrow<*mut xcb_screen_t> for XCBScreen
impl FromGlibPtrBorrow<*mut cairo_surface_t> for XCBSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for XCBSurface
impl FromGlibPtrBorrow<*mut xcb_visualtype_t> for XCBVisualType
impl FromGlibPtrBorrow<*mut xcb_visualtype_t> for XCBVisualType
impl FromGlibPtrBorrow<*mut cairo_surface_t> for PdfSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for PdfSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for PsSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for PsSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for SvgSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for SvgSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for QuartzSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for QuartzSurface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for Win32Surface
impl FromGlibPtrBorrow<*mut cairo_surface_t> for Win32Surface