Replace Str-generic method with a new trait

See rust-lang/rust#16738.
Test-build the C API on Travis