format/format: use lifetime elision
This commit is contained in:
parent
3c227329ae
commit
604c6549fb
@ -10,28 +10,28 @@ pub enum Format {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Format {
|
impl Format {
|
||||||
pub fn name<'a>(&'a self) -> &'a str {
|
pub fn name(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
&Format::Input(ref f) => f.name(),
|
&Format::Input(ref f) => f.name(),
|
||||||
&Format::Output(ref f) => f.name()
|
&Format::Output(ref f) => f.name()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn description<'a>(&'a self) -> &'a str {
|
pub fn description(&self) -> &str {
|
||||||
match self {
|
match self {
|
||||||
&Format::Input(ref f) => f.description(),
|
&Format::Input(ref f) => f.description(),
|
||||||
&Format::Output(ref f) => f.description()
|
&Format::Output(ref f) => f.description()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extensions<'a>(&'a self) -> Vec<&'a str> {
|
pub fn extensions(&self) -> Vec<&str> {
|
||||||
match self {
|
match self {
|
||||||
&Format::Input(ref f) => f.extensions(),
|
&Format::Input(ref f) => f.extensions(),
|
||||||
&Format::Output(ref f) => f.extensions()
|
&Format::Output(ref f) => f.extensions()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mime_types<'a>(&'a self) -> Vec<&'a str> {
|
pub fn mime_types(&self) -> Vec<&str> {
|
||||||
match self {
|
match self {
|
||||||
&Format::Input(ref f) => f.mime_types(),
|
&Format::Input(ref f) => f.mime_types(),
|
||||||
&Format::Output(ref f) => f.mime_types()
|
&Format::Output(ref f) => f.mime_types()
|
||||||
@ -48,19 +48,19 @@ impl Input {
|
|||||||
Input { ptr: ptr }
|
Input { ptr: ptr }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name<'a>(&'a self) -> &'a str {
|
pub fn name(&self) -> &str {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_utf8_unchecked(CStr::from_ptr((*self.ptr).name).to_bytes())
|
from_utf8_unchecked(CStr::from_ptr((*self.ptr).name).to_bytes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn description<'a>(&'a self) -> &'a str {
|
pub fn description(&self) -> &str {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_utf8_unchecked(CStr::from_ptr((*self.ptr).name).to_bytes())
|
from_utf8_unchecked(CStr::from_ptr((*self.ptr).name).to_bytes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extensions<'a>(&'a self) -> Vec<&'a str> {
|
pub fn extensions(&self) -> Vec<&str> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = (*self.ptr).extensions;
|
let ptr = (*self.ptr).extensions;
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ impl Input {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mime_types<'a>(&'a self) -> Vec<&'a str> {
|
pub fn mime_types(&self) -> Vec<&str> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = (*self.ptr).mime_type;
|
let ptr = (*self.ptr).mime_type;
|
||||||
|
|
||||||
@ -96,19 +96,19 @@ impl Output {
|
|||||||
Output { ptr: ptr }
|
Output { ptr: ptr }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn name<'a>(&'a self) -> &'a str {
|
pub fn name(&self) -> &str {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_utf8_unchecked(CStr::from_ptr((*self.ptr).name).to_bytes())
|
from_utf8_unchecked(CStr::from_ptr((*self.ptr).name).to_bytes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn description<'a>(&'a self) -> &'a str {
|
pub fn description(&self) -> &str {
|
||||||
unsafe {
|
unsafe {
|
||||||
from_utf8_unchecked(CStr::from_ptr((*self.ptr).name).to_bytes())
|
from_utf8_unchecked(CStr::from_ptr((*self.ptr).name).to_bytes())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn extensions<'a>(&'a self) -> Vec<&'a str> {
|
pub fn extensions(&self) -> Vec<&str> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = (*self.ptr).extensions;
|
let ptr = (*self.ptr).extensions;
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ impl Output {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn mime_types<'a>(&'a self) -> Vec<&'a str> {
|
pub fn mime_types(&self) -> Vec<&str> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let ptr = (*self.ptr).mime_type;
|
let ptr = (*self.ptr).mime_type;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user