pub fn init(flags: InitFlag) -> Result<Sdl2MixerContext, String> {
    let return_flags = unsafe {
        let ret = sys::mixer::Mix_Init(flags.bits() as c_int);
        InitFlag::from_bits_truncate(ret as u32)
    };
    // Check if all init flags were set
    if flags.intersects(return_flags) {
        Ok(Sdl2MixerContext)
    } else {
        // Flags not matching won't always set the error message text
        // according to sdl docs
        if get_error() == "" {
            let un_init_flags = return_flags ^ flags;
            let error_str = &("Could not init: ".to_string() + &un_init_flags.to_string());
            let _ = ::set_error(error_str);
        }
        Err(get_error())
    }
}
/// Loads dynamic libraries and prepares them for use.  Flags should be
/// one or more flags from `InitFlag`.
Loads dynamic libraries and prepares them for use.  Flags should be
one or more flags from `InitFlag`.
Loads dynamic libraries and prepares them for use . Flags should be one or more flags from ` InitFlag ` .
pub fn init(flags: InitFlag) -> Result<Sdl2MixerContext, String> {
    let return_flags = unsafe {
        let ret = sys::mixer::Mix_Init(flags.bits() as c_int);
        InitFlag::from_bits_truncate(ret as u32)
    };
    // Check if all init flags were set
    if flags.intersects(return_flags) {
        Ok(Sdl2MixerContext)
    } else {
        // Flags not matching won't always set the error message text
        // according to sdl docs
        if get_error() == "" {
            let un_init_flags = return_flags ^ flags;
            let error_str = &("Could not init: ".to_string() + &un_init_flags.to_string());
            let _ = ::set_error(error_str);
        }
        Err(get_error())
    }
}
pub fn init ( flags : InitFlag ) -> Result < Sdl2MixerContext , String > { let return_flags = unsafe { let ret = sys :: mixer :: Mix_Init ( flags . bits ( ) as c_int ) ; InitFlag :: from_bits_truncate ( ret as u32 ) } ; // Check if all init flags were set if flags . intersects ( return_flags ) { Ok ( Sdl2MixerContext ) } else { // Flags not matching won't always set the error message text // according to sdl docs if get_error ( ) == " " { let un_init_flags = return_flags ^ flags ; let error_str = & ( " " . to_string ( ) + & un_init_flags . to_string ( ) ) ; let _ = :: set_error ( error_str ) ; } Err ( get_error ( ) ) } }
Loads dynamic libraries and prepares them for use.
Loads dynamic libraries and prepares them for use .
flags
InitFlag
flags
InitFlag