Files
rust/crates/ra_lsp_server/src/conv.rs

493 lines
17 KiB
Rust
Raw Normal View History

2019-01-14 13:55:56 +03:00
use lsp_types::{
2019-08-06 09:29:06 +02:00
self, CreateFile, DiagnosticSeverity, DocumentChangeOperation, DocumentChanges, Documentation,
Location, LocationLink, MarkupContent, MarkupKind, Position, Range, RenameFile, ResourceOp,
SymbolKind, TextDocumentEdit, TextDocumentIdentifier, TextDocumentItem,
TextDocumentPositionParams, Url, VersionedTextDocumentIdentifier, WorkspaceEdit,
2018-08-17 19:54:08 +03:00
};
2019-01-08 22:33:36 +03:00
use ra_ide_api::{
translate_offset_with_edit, CompletionItem, CompletionItemKind, FileId, FilePosition,
FileRange, FileSystemEdit, InsertTextFormat, LineCol, LineIndex, NavigationTarget, RangeInfo,
2019-08-06 09:29:06 +02:00
Severity, SourceChange, SourceFileEdit,
};
use ra_syntax::{SyntaxKind, TextRange, TextUnit};
use ra_text_edit::{AtomTextEdit, TextEdit};
2019-08-20 18:53:59 +03:00
use ra_vfs::LineEndings;
2019-06-01 10:31:40 +03:00
use crate::{req, world::WorldSnapshot, Result};
2018-08-13 16:35:17 +03:00
2018-08-12 21:02:56 +03:00
pub trait Conv {
type Output;
2018-08-13 02:38:34 +03:00
fn conv(self) -> Self::Output;
2018-08-12 21:02:56 +03:00
}
pub trait ConvWith<CTX> {
2018-08-12 21:02:56 +03:00
type Output;
fn conv_with(self, ctx: CTX) -> Self::Output;
2018-08-12 21:02:56 +03:00
}
pub trait TryConvWith<CTX> {
2018-08-13 16:35:17 +03:00
type Output;
fn try_conv_with(self, ctx: CTX) -> Result<Self::Output>;
2018-08-13 16:35:17 +03:00
}
2018-08-12 21:02:56 +03:00
impl Conv for SyntaxKind {
type Output = SymbolKind;
2018-08-13 02:38:34 +03:00
fn conv(self) -> <Self as Conv>::Output {
match self {
2018-08-13 18:27:26 +03:00
SyntaxKind::FN_DEF => SymbolKind::Function,
SyntaxKind::STRUCT_DEF => SymbolKind::Struct,
SyntaxKind::ENUM_DEF => SymbolKind::Enum,
2019-03-11 13:58:38 -04:00
SyntaxKind::ENUM_VARIANT => SymbolKind::EnumMember,
2018-08-13 18:27:26 +03:00
SyntaxKind::TRAIT_DEF => SymbolKind::Interface,
2018-08-12 21:02:56 +03:00
SyntaxKind::MODULE => SymbolKind::Module,
SyntaxKind::TYPE_ALIAS_DEF => SymbolKind::TypeParameter,
2019-08-23 15:55:21 +03:00
SyntaxKind::RECORD_FIELD_DEF => SymbolKind::Field,
2018-08-13 18:27:26 +03:00
SyntaxKind::STATIC_DEF => SymbolKind::Constant,
SyntaxKind::CONST_DEF => SymbolKind::Constant,
SyntaxKind::IMPL_BLOCK => SymbolKind::Object,
2018-08-12 21:02:56 +03:00
_ => SymbolKind::Variable,
}
}
}
2018-12-22 02:02:47 +03:00
impl Conv for CompletionItemKind {
2019-01-14 13:55:56 +03:00
type Output = ::lsp_types::CompletionItemKind;
2018-12-22 02:02:47 +03:00
fn conv(self) -> <Self as Conv>::Output {
2019-01-14 13:55:56 +03:00
use lsp_types::CompletionItemKind::*;
2018-12-22 02:02:47 +03:00
match self {
CompletionItemKind::Keyword => Keyword,
CompletionItemKind::Snippet => Snippet,
2018-12-22 02:20:14 +03:00
CompletionItemKind::Module => Module,
CompletionItemKind::Function => Function,
CompletionItemKind::Struct => Struct,
CompletionItemKind::Enum => Enum,
2018-12-28 21:06:08 +03:00
CompletionItemKind::EnumVariant => EnumMember,
2019-05-30 16:10:07 +03:00
CompletionItemKind::BuiltinType => Struct,
2018-12-22 02:24:59 +03:00
CompletionItemKind::Binding => Variable,
2018-12-25 15:15:40 +01:00
CompletionItemKind::Field => Field,
2019-01-11 21:02:12 +03:00
CompletionItemKind::Trait => Interface,
CompletionItemKind::TypeAlias => Struct,
CompletionItemKind::Const => Constant,
CompletionItemKind::Static => Value,
2019-01-07 19:12:19 +01:00
CompletionItemKind::Method => Method,
2019-01-27 20:50:57 +01:00
CompletionItemKind::TypeParam => TypeParameter,
2019-04-24 21:16:50 +01:00
CompletionItemKind::Macro => Method,
2018-12-22 02:02:47 +03:00
}
}
}
2019-08-06 09:29:06 +02:00
impl Conv for Severity {
type Output = DiagnosticSeverity;
fn conv(self) -> DiagnosticSeverity {
match self {
Severity::Error => DiagnosticSeverity::Error,
Severity::WeakWarning => DiagnosticSeverity::Hint,
}
}
}
2019-08-20 19:06:22 +03:00
impl ConvWith<(&LineIndex, LineEndings)> for CompletionItem {
2019-01-14 13:55:56 +03:00
type Output = ::lsp_types::CompletionItem;
2018-12-22 01:59:32 +03:00
2019-08-20 18:53:59 +03:00
fn conv_with(self, ctx: (&LineIndex, LineEndings)) -> ::lsp_types::CompletionItem {
let mut additional_text_edits = Vec::new();
let mut text_edit = None;
// LSP does not allow arbitrary edits in completion, so we have to do a
// non-trivial mapping here.
for atom_edit in self.text_edit().as_atoms() {
if self.source_range().is_subrange(&atom_edit.delete) {
text_edit = Some(if atom_edit.delete == self.source_range() {
atom_edit.conv_with(ctx)
} else {
assert!(self.source_range().end() == atom_edit.delete.end());
let range1 =
TextRange::from_to(atom_edit.delete.start(), self.source_range().start());
let range2 = self.source_range();
let edit1 = AtomTextEdit::replace(range1, String::new());
let edit2 = AtomTextEdit::replace(range2, atom_edit.insert.clone());
additional_text_edits.push(edit1.conv_with(ctx));
edit2.conv_with(ctx)
})
} else {
assert!(self.source_range().intersection(&atom_edit.delete).is_none());
additional_text_edits.push(atom_edit.conv_with(ctx));
}
}
let text_edit = text_edit.unwrap();
let mut res = lsp_types::CompletionItem {
2018-12-22 01:59:32 +03:00
label: self.label().to_string(),
2019-01-09 18:09:49 +03:00
detail: self.detail().map(|it| it.to_string()),
2018-12-22 01:59:32 +03:00
filter_text: Some(self.lookup().to_string()),
2018-12-22 02:02:47 +03:00
kind: self.kind().map(|it| it.conv()),
text_edit: Some(text_edit),
additional_text_edits: Some(additional_text_edits),
documentation: self.documentation().map(|it| it.conv()),
2018-12-22 01:59:32 +03:00
..Default::default()
};
res.insert_text_format = Some(match self.insert_text_format() {
InsertTextFormat::Snippet => lsp_types::InsertTextFormat::Snippet,
InsertTextFormat::PlainText => lsp_types::InsertTextFormat::PlainText,
});
2018-12-22 01:59:32 +03:00
res
}
}
2019-08-20 19:06:22 +03:00
impl ConvWith<&LineIndex> for Position {
2018-08-12 21:02:56 +03:00
type Output = TextUnit;
2018-08-13 02:38:34 +03:00
fn conv_with(self, line_index: &LineIndex) -> TextUnit {
2019-02-08 14:49:43 +03:00
let line_col = LineCol { line: self.line as u32, col_utf16: self.character as u32 };
2018-08-12 21:02:56 +03:00
line_index.offset(line_col)
}
}
2019-08-20 19:06:22 +03:00
impl ConvWith<&LineIndex> for TextUnit {
2018-08-12 21:02:56 +03:00
type Output = Position;
2018-08-13 02:38:34 +03:00
fn conv_with(self, line_index: &LineIndex) -> Position {
let line_col = line_index.line_col(self);
2018-11-29 15:30:49 -05:00
Position::new(u64::from(line_col.line), u64::from(line_col.col_utf16))
2018-08-12 21:02:56 +03:00
}
}
2019-08-20 19:06:22 +03:00
impl ConvWith<&LineIndex> for TextRange {
2018-08-12 21:02:56 +03:00
type Output = Range;
2018-08-13 02:38:34 +03:00
fn conv_with(self, line_index: &LineIndex) -> Range {
2019-02-08 14:49:43 +03:00
Range::new(self.start().conv_with(line_index), self.end().conv_with(line_index))
2018-08-12 21:02:56 +03:00
}
}
2019-08-20 19:06:22 +03:00
impl ConvWith<&LineIndex> for Range {
2018-08-12 21:02:56 +03:00
type Output = TextRange;
2018-08-13 02:38:34 +03:00
fn conv_with(self, line_index: &LineIndex) -> TextRange {
2019-02-08 14:49:43 +03:00
TextRange::from_to(self.start.conv_with(line_index), self.end.conv_with(line_index))
2018-08-12 21:02:56 +03:00
}
}
2018-08-13 02:38:34 +03:00
impl Conv for ra_ide_api::Documentation {
type Output = lsp_types::Documentation;
fn conv(self) -> Documentation {
Documentation::MarkupContent(MarkupContent {
kind: MarkupKind::Markdown,
value: crate::markdown::format_docs(self.as_str()),
})
}
}
impl Conv for ra_ide_api::FunctionSignature {
type Output = lsp_types::SignatureInformation;
fn conv(self) -> Self::Output {
use lsp_types::{ParameterInformation, ParameterLabel, SignatureInformation};
let label = self.to_string();
let documentation = self.doc.map(|it| it.conv());
let parameters: Vec<ParameterInformation> = self
.parameters
.into_iter()
.map(|param| ParameterInformation {
label: ParameterLabel::Simple(param),
documentation: None,
})
.collect();
SignatureInformation { label, documentation, parameters: Some(parameters) }
}
}
2019-08-20 19:06:22 +03:00
impl ConvWith<(&LineIndex, LineEndings)> for TextEdit {
2019-01-14 13:55:56 +03:00
type Output = Vec<lsp_types::TextEdit>;
2018-08-13 02:38:34 +03:00
2019-08-20 18:53:59 +03:00
fn conv_with(self, ctx: (&LineIndex, LineEndings)) -> Vec<lsp_types::TextEdit> {
self.as_atoms().iter().map_conv_with(ctx).collect()
2018-08-13 02:38:34 +03:00
}
}
2019-08-20 19:06:22 +03:00
impl ConvWith<(&LineIndex, LineEndings)> for &AtomTextEdit {
2019-01-14 13:55:56 +03:00
type Output = lsp_types::TextEdit;
2018-08-13 02:38:34 +03:00
2019-08-20 18:53:59 +03:00
fn conv_with(
self,
(line_index, line_endings): (&LineIndex, LineEndings),
) -> lsp_types::TextEdit {
let mut new_text = self.insert.clone();
if line_endings == LineEndings::Dos {
new_text = new_text.replace('\n', "\r\n");
2018-08-13 02:38:34 +03:00
}
2019-08-20 18:53:59 +03:00
lsp_types::TextEdit { range: self.delete.conv_with(line_index), new_text }
2018-08-13 02:38:34 +03:00
}
}
impl<T: ConvWith<CTX>, CTX> ConvWith<CTX> for Option<T> {
type Output = Option<T::Output>;
fn conv_with(self, ctx: CTX) -> Self::Output {
2018-08-16 00:23:22 +03:00
self.map(|x| ConvWith::conv_with(x, ctx))
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for &Url {
2018-08-15 17:24:20 +03:00
type Output = FileId;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<FileId> {
2018-08-17 19:54:08 +03:00
world.uri_to_file_id(self)
2018-08-15 17:24:20 +03:00
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for FileId {
2018-08-15 17:24:20 +03:00
type Output = Url;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<Url> {
2018-08-17 19:54:08 +03:00
world.file_id_to_uri(self)
2018-08-15 17:24:20 +03:00
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for &TextDocumentItem {
2018-08-15 17:24:20 +03:00
type Output = FileId;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<FileId> {
2018-08-17 19:54:08 +03:00
self.uri.try_conv_with(world)
2018-08-15 17:24:20 +03:00
}
}
2018-08-13 16:35:17 +03:00
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for &VersionedTextDocumentIdentifier {
2018-08-15 17:24:20 +03:00
type Output = FileId;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<FileId> {
2018-08-17 19:54:08 +03:00
self.uri.try_conv_with(world)
2018-08-15 17:24:20 +03:00
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for &TextDocumentIdentifier {
2018-08-15 17:24:20 +03:00
type Output = FileId;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<FileId> {
2018-08-17 19:54:08 +03:00
world.uri_to_file_id(&self.uri)
2018-08-15 17:24:20 +03:00
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for &TextDocumentPositionParams {
2018-11-05 14:57:41 +03:00
type Output = FilePosition;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<FilePosition> {
2018-11-05 14:57:41 +03:00
let file_id = self.text_document.try_conv_with(world)?;
2019-07-25 20:22:41 +03:00
let line_index = world.analysis().file_line_index(file_id)?;
2018-11-05 14:57:41 +03:00
let offset = self.position.conv_with(&line_index);
Ok(FilePosition { file_id, offset })
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for (&TextDocumentIdentifier, Range) {
2018-12-28 18:15:19 +03:00
type Output = FileRange;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<FileRange> {
2018-12-28 18:15:19 +03:00
let file_id = self.0.try_conv_with(world)?;
2019-07-25 20:22:41 +03:00
let line_index = world.analysis().file_line_index(file_id)?;
2018-12-28 18:15:19 +03:00
let range = self.1.conv_with(&line_index);
Ok(FileRange { file_id, range })
}
}
impl<T: TryConvWith<CTX>, CTX: Copy> TryConvWith<CTX> for Vec<T> {
type Output = Vec<<T as TryConvWith<CTX>>::Output>;
fn try_conv_with(self, ctx: CTX) -> Result<Self::Output> {
2018-08-29 18:03:14 +03:00
let mut res = Vec::with_capacity(self.len());
for item in self {
res.push(item.try_conv_with(ctx)?);
}
Ok(res)
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for SourceChange {
2018-08-29 18:03:14 +03:00
type Output = req::SourceChange;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<req::SourceChange> {
2018-08-29 18:03:14 +03:00
let cursor_position = match self.cursor_position {
None => None,
Some(pos) => {
2019-07-25 20:22:41 +03:00
let line_index = world.analysis().file_line_index(pos.file_id)?;
let edit = self
.source_file_edits
.iter()
.find(|it| it.file_id == pos.file_id)
.map(|it| &it.edit);
let line_col = match edit {
Some(edit) => translate_offset_with_edit(&*line_index, pos.offset, edit),
None => line_index.line_col(pos.offset),
};
2018-11-29 15:30:49 -05:00
let position =
Position::new(u64::from(line_col.line), u64::from(line_col.col_utf16));
2018-08-29 18:03:14 +03:00
Some(TextDocumentPositionParams {
text_document: TextDocumentIdentifier::new(pos.file_id.try_conv_with(world)?),
position,
2018-08-29 18:03:14 +03:00
})
}
};
let mut document_changes: Vec<DocumentChangeOperation> = Vec::new();
for resource_op in self.file_system_edits.try_conv_with(world)? {
document_changes.push(DocumentChangeOperation::Op(resource_op));
}
for text_document_edit in self.source_file_edits.try_conv_with(world)? {
document_changes.push(DocumentChangeOperation::Edit(text_document_edit));
}
let workspace_edit = WorkspaceEdit {
changes: None,
document_changes: Some(DocumentChanges::Operations(document_changes)),
};
2019-02-08 14:49:43 +03:00
Ok(req::SourceChange { label: self.label, workspace_edit, cursor_position })
2018-08-29 18:03:14 +03:00
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for SourceFileEdit {
2018-08-29 18:03:14 +03:00
type Output = TextDocumentEdit;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<TextDocumentEdit> {
2018-08-29 18:03:14 +03:00
let text_document = VersionedTextDocumentIdentifier {
uri: self.file_id.try_conv_with(world)?,
version: None,
};
2019-07-25 20:22:41 +03:00
let line_index = world.analysis().file_line_index(self.file_id)?;
2019-08-20 18:53:59 +03:00
let line_endings = world.file_line_endings(self.file_id);
let edits =
self.edit.as_atoms().iter().map_conv_with((&line_index, line_endings)).collect();
2019-02-08 14:49:43 +03:00
Ok(TextDocumentEdit { text_document, edits })
2018-08-29 18:03:14 +03:00
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for FileSystemEdit {
type Output = ResourceOp;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<ResourceOp> {
2018-08-29 18:03:14 +03:00
let res = match self {
2018-12-21 12:18:14 +03:00
FileSystemEdit::CreateFile { source_root, path } => {
2019-01-14 13:55:56 +03:00
let uri = world.path_to_uri(source_root, &path)?;
ResourceOp::Create(CreateFile { uri, options: None })
}
2019-02-08 14:49:43 +03:00
FileSystemEdit::MoveFile { src, dst_source_root, dst_path } => {
2019-01-14 13:55:56 +03:00
let old_uri = world.file_id_to_uri(src)?;
let new_uri = world.path_to_uri(dst_source_root, &dst_path)?;
2019-02-08 14:49:43 +03:00
ResourceOp::Rename(RenameFile { old_uri, new_uri, options: None })
}
2018-08-29 18:03:14 +03:00
};
Ok(res)
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for &NavigationTarget {
2019-01-02 17:09:39 +03:00
type Output = Location;
2019-06-01 10:31:40 +03:00
fn try_conv_with(self, world: &WorldSnapshot) -> Result<Location> {
2019-07-25 20:22:41 +03:00
let line_index = world.analysis().file_line_index(self.file_id())?;
let range = self.range();
2019-01-11 18:17:20 +03:00
to_location(self.file_id(), range, &world, &line_index)
2019-01-11 14:14:09 +03:00
}
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for (FileId, RangeInfo<NavigationTarget>) {
2019-07-08 13:39:16 +03:00
type Output = LocationLink;
fn try_conv_with(self, world: &WorldSnapshot) -> Result<LocationLink> {
let (src_file_id, target) = self;
let target_uri = target.info.file_id().try_conv_with(world)?;
2019-07-25 20:22:41 +03:00
let src_line_index = world.analysis().file_line_index(src_file_id)?;
let tgt_line_index = world.analysis().file_line_index(target.info.file_id())?;
2019-07-08 13:39:16 +03:00
let target_range = target.info.full_range().conv_with(&tgt_line_index);
let target_selection_range = target
.info
.focus_range()
.map(|it| it.conv_with(&tgt_line_index))
.unwrap_or(target_range);
let res = LocationLink {
origin_selection_range: Some(target.range.conv_with(&src_line_index)),
target_uri,
target_range,
target_selection_range,
};
Ok(res)
}
2019-01-02 17:09:39 +03:00
}
2019-08-20 19:06:22 +03:00
impl TryConvWith<&WorldSnapshot> for (FileId, RangeInfo<Vec<NavigationTarget>>) {
2019-07-08 13:47:02 +03:00
type Output = req::GotoDefinitionResponse;
fn try_conv_with(self, world: &WorldSnapshot) -> Result<req::GotoTypeDefinitionResponse> {
let (file_id, RangeInfo { range, info: navs }) = self;
let links = navs
.into_iter()
.map(|nav| (file_id, RangeInfo::new(range, nav)))
.try_conv_with_to_vec(world)?;
if world.options.supports_location_link {
Ok(links.into())
} else {
let locations: Vec<Location> = links
.into_iter()
.map(|link| Location { uri: link.target_uri, range: link.target_selection_range })
.collect();
Ok(locations.into())
}
2019-07-08 13:47:02 +03:00
}
}
2018-08-15 17:24:20 +03:00
pub fn to_location(
file_id: FileId,
range: TextRange,
2019-06-01 10:31:40 +03:00
world: &WorldSnapshot,
2018-08-15 17:24:20 +03:00
line_index: &LineIndex,
) -> Result<Location> {
let url = file_id.try_conv_with(world)?;
let loc = Location::new(url, range.conv_with(line_index));
Ok(loc)
2018-08-13 16:35:17 +03:00
}
pub trait MapConvWith<CTX>: Sized {
2018-08-13 02:38:34 +03:00
type Output;
fn map_conv_with(self, ctx: CTX) -> ConvWithIter<Self, CTX> {
2018-08-13 02:38:34 +03:00
ConvWithIter { iter: self, ctx }
}
}
impl<CTX, I> MapConvWith<CTX> for I
where
I: Iterator,
I::Item: ConvWith<CTX>,
2018-08-13 02:38:34 +03:00
{
type Output = <I::Item as ConvWith<CTX>>::Output;
2018-08-13 02:38:34 +03:00
}
pub struct ConvWithIter<I, CTX> {
2018-08-13 02:38:34 +03:00
iter: I,
ctx: CTX,
2018-08-13 02:38:34 +03:00
}
impl<I, CTX> Iterator for ConvWithIter<I, CTX>
where
I: Iterator,
I::Item: ConvWith<CTX>,
CTX: Copy,
2018-08-13 02:38:34 +03:00
{
type Item = <I::Item as ConvWith<CTX>>::Output;
2018-08-13 02:38:34 +03:00
fn next(&mut self) -> Option<Self::Item> {
self.iter.next().map(|item| item.conv_with(self.ctx))
}
}
2019-07-08 13:39:16 +03:00
pub trait TryConvWithToVec<CTX>: Sized {
2019-07-08 13:39:16 +03:00
type Output;
fn try_conv_with_to_vec(self, ctx: CTX) -> Result<Vec<Self::Output>>;
2019-07-08 13:39:16 +03:00
}
impl<I, CTX> TryConvWithToVec<CTX> for I
2019-07-08 13:39:16 +03:00
where
I: Iterator,
I::Item: TryConvWith<CTX>,
CTX: Copy,
2019-07-08 13:39:16 +03:00
{
type Output = <I::Item as TryConvWith<CTX>>::Output;
2019-07-08 13:39:16 +03:00
fn try_conv_with_to_vec(self, ctx: CTX) -> Result<Vec<Self::Output>> {
2019-07-08 13:39:16 +03:00
self.map(|it| it.try_conv_with(ctx)).collect()
}
}