Function subparse::get_subtitle_format[][src]

pub fn get_subtitle_format(
    extension: Option<&OsStr>,
    content: &[u8]
) -> Option<SubtitleFormat>

Returns the subtitle format by the file extension and provided content.

Calling the function with the full file path or simply a get_subtitle_format(".sub", content) both work. Returns None if subtitle format could not be recognized.

It works exactly the same as get_subtitle_format_by_extension (see documentation), but also handles the .sub cases correctly by using the provided content of the file as secondary info.

Option is used to simplify handling with PathBuf::extension().