Skip to content
This repository has been archived by the owner on Jun 8, 2021. It is now read-only.

Remove generic pointer array impls of ToGlibPtr and FromGlibContainer #198

Merged
merged 3 commits into from
Jul 18, 2017
Merged

Remove generic pointer array impls of ToGlibPtr and FromGlibContainer #198

merged 3 commits into from
Jul 18, 2017

Commits on Jul 18, 2017

  1. Remove generic pointer array impls of ToGlibPtr and FromGlibContainer

    This introduces new traits:
    - ToGlibContainerFromSlice: Conversion from a &[Self] into some GLib
      container (array, GList, etc).
    
    - FromGlibContainerAsVec: Conversion from a GLib container (array,
      GList, etc) to a Vec<Self>. This always requires the length to be
      given and can be used for non-pointer containers (e.g. uint8_t[]).
    
    - FromGlibPtrContainerAsVec: Some as FromGlibContainerAsVec but does not
      require the length, and instead requires pointers as elements and the
      container to be NULL-terminated
    
    They are all implemented for T and not [T]/Vec<T>, which is required for this to
    be possible to implement in crates other than the glib crate.
    
    impls for Strings and fundamental types exist in GLib, glib_wrapper!()
    is automatically implementing them too.
    
    Based on these there are generic implementations for ToGlibPtr for [T]
    and FromGlibContainer for Vec<T>.
    
    Also split FromGlibPtrContainer into FromGlibContainer and FromGlibPtrContainer,
    the first requiring a length to be given (and thus is usable for
    non-NULL terminated or non-pointer containers), the second requires
    pointers and NULL-termination.
    
    With all this in place it is now possible to implement conversions
    from/to containers of fundamental types, enums, flags, etc.
    sdroege committed Jul 18, 2017
    Configuration menu
    Copy the full SHA
    bafb172 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    6eb847d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    0f1d658 View commit details
    Browse the repository at this point in the history