Skip to content

Commit

Permalink
fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
generall committed Jun 19, 2024
1 parent db28168 commit f74f34a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
15 changes: 12 additions & 3 deletions src/grpc_conversions/primitives.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@ use crate::prelude::point_id::PointIdOptions;
use crate::prelude::{DeleteCollection, Value};
use crate::qdrant::value::Kind;
use crate::qdrant::vectors::VectorsOptions;
use crate::qdrant::{shard_key, with_payload_selector, with_vectors_selector, CollectionClusterInfoRequest, CollectionExistsRequest, CreateSnapshotRequest, DeleteAlias, DeleteCollectionBuilder, DeleteFullSnapshotRequest, GetCollectionInfoRequest, IsEmptyCondition, IsNullCondition, ListCollectionAliasesRequest, ListSnapshotsRequest, NamedVectors, PayloadExcludeSelector, PayloadIncludeSelector, PointId, RepeatedIntegers, RepeatedStrings, ShardKeySelector, SparseIndices, SparseVectorConfig, SparseVectorParams, Struct, Vector, VectorParams, VectorParamsDiff, VectorParamsDiffMap, VectorParamsMap, Vectors, VectorsSelector, WithPayloadSelector, WithVectorsSelector, ShardKey};
use crate::qdrant::{
shard_key, with_payload_selector, with_vectors_selector, CollectionClusterInfoRequest,
CollectionExistsRequest, CreateSnapshotRequest, DeleteAlias, DeleteCollectionBuilder,
DeleteFullSnapshotRequest, GetCollectionInfoRequest, IsEmptyCondition, IsNullCondition,
ListCollectionAliasesRequest, ListSnapshotsRequest, NamedVectors, PayloadExcludeSelector,
PayloadIncludeSelector, PointId, RepeatedIntegers, RepeatedStrings, ShardKey, ShardKeySelector,
SparseIndices, SparseVectorConfig, SparseVectorParams, Struct, Vector, VectorParams,
VectorParamsDiff, VectorParamsDiffMap, VectorParamsMap, Vectors, VectorsSelector,
WithPayloadSelector, WithVectorsSelector,
};
use std::collections::HashMap;

impl From<bool> for WithPayloadSelector {
Expand Down Expand Up @@ -185,8 +194,8 @@ impl From<&str> for Value {
}

impl<T> From<Vec<(&str, T)>> for Value
where
T: Into<Value>,
where
T: Into<Value>,
{
fn from(val: Vec<(&str, T)>) -> Self {
Self {
Expand Down
11 changes: 4 additions & 7 deletions tests/protos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ enum MacroConfig {
trait BuilderExt {
fn configure_derive_builder(self) -> Self;
fn derive_builders(self, paths: &[(&str, &str)], derive_options: &[BuildDeriveOptions])
-> Self;
-> Self;
fn derive_builder(self, path: &str, derive_options: Option<&str>) -> Self;
fn field_build_attributes(self, paths: &[(&str, &str)]) -> Self;
}
Expand Down Expand Up @@ -539,7 +539,6 @@ fn configure_builder(builder: Builder) -> Builder {
builder_custom_into!(read_consistency::Value, self.read_consistency),
),
("DiscoverBatchPoints.timeout", DEFAULT_OPTION),

// PrefetchQuery
("PrefetchQuery.collection_name", PUBLIC_ONLY),
("PrefetchQuery.prefetch", DEFAULT_OPTION_INTO),
Expand All @@ -550,7 +549,6 @@ fn configure_builder(builder: Builder) -> Builder {
("PrefetchQuery.score_threshold", DEFAULT_OPTION_INTO),
("PrefetchQuery.limit", DEFAULT_OPTION_INTO),
("PrefetchQuery.lookup_from", DEFAULT_OPTION_INTO),

// Query
("QueryPoints.collection_name", PUBLIC_ONLY),
("QueryPoints.query", DEFAULT_OPTION_INTO),
Expand All @@ -575,7 +573,6 @@ fn configure_builder(builder: Builder) -> Builder {
("QueryPoints.shard_key_selector", DEFAULT_OPTION_INTO),
("QueryPoints.lookup_from", DEFAULT_OPTION_INTO),
("QueryPoints.timeout", DEFAULT_OPTION),

// CountPoints
("CountPoints.collection_name", PUBLIC_ONLY),
("CountPoints.filter", DEFAULT_OPTION_INTO),
Expand Down Expand Up @@ -934,8 +931,8 @@ fn additional_builder_derive_options() -> &'static [BuildDeriveOptions] {

/// Returns a list of all unique structs that appear in a list of paths.
fn unique_structs_from_paths<'a, I>(paths: I, extra: &[&'a str]) -> Vec<&'a str>
where
I: IntoIterator<Item=&'a str>,
where
I: IntoIterator<Item = &'a str>,
{
let mut derives = paths
.into_iter()
Expand All @@ -959,7 +956,7 @@ fn append_to_file(path: &str, line: &str) {
OpenOptions::new().append(true).open(path).unwrap(),
"{line}",
)
.unwrap()
.unwrap()
}

/// Generates all necessary macro calls for builders who should have them.
Expand Down

0 comments on commit f74f34a

Please sign in to comment.