pub struct Depend { /* private fields */ }

Implementations§

Examples found in repository?
src/search.rs (line 102)
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
    fn exec_cond(
        collection: &Collection,
        relation: &RelationIndex,
        condtion: &Condition,
        tx: Sender<RowSet>,
    ) {
        match condtion {
            Condition::Activity(c) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::Activity(*c),
                    tx,
                );
            }
            Condition::Term(c) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::Term(c.clone()),
                    tx,
                );
            }
            Condition::Row(c) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::Row(c.clone()),
                    tx,
                );
            }
            Condition::Uuid(c) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::Uuid(c.clone()),
                    tx,
                );
            }
            Condition::LastUpdated(c) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::LastUpdated(c.clone()),
                    tx,
                );
            }
            Condition::Field(key, condition) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::Field(key.to_owned(), condition.clone()),
                    tx,
                );
            }
            Condition::Depend(depend) => {
                let rel = relation.pends(depend.key(), depend.collection_row());
                let collection_id = collection.id();
                std::thread::spawn(move || {
                    let mut tmp = RowSet::default();
                    for r in rel {
                        if r.collection_id() == collection_id {
                            tmp.insert(r.row());
                        }
                    }
                    let tx = tx.clone();
                    tx.send(tmp).unwrap();
                });
            }
            Condition::Narrow(conditions) => {
                let (tx_inner, rx) = std::sync::mpsc::channel();
                for c in conditions {
                    let tx_inner = tx_inner.clone();
                    Self::exec_cond(collection, relation, c, tx_inner);
                }
                drop(tx_inner);
                std::thread::spawn(move || {
                    let mut is_1st = true;
                    let mut tmp = RowSet::default();
                    for mut rs in rx {
                        if is_1st {
                            tmp = rs;
                            is_1st = false;
                        } else {
                            tmp = tmp.intersection(&mut rs).map(|&x| x).collect();
                        }
                    }
                    tx.send(tmp).unwrap();
                });
            }
            Condition::Wide(conditions) => {
                let (tx_inner, rx) = std::sync::mpsc::channel();
                for c in conditions {
                    let tx_inner = tx_inner.clone();
                    Self::exec_cond(collection, relation, c, tx_inner);
                }
                drop(tx_inner);
                std::thread::spawn(move || {
                    let mut tmp = RowSet::default();
                    for ref mut rs in rx {
                        tmp.append(rs);
                    }
                    tx.send(tmp).unwrap();
                });
            }
        }
    }
Examples found in repository?
src/search.rs (line 102)
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
    fn exec_cond(
        collection: &Collection,
        relation: &RelationIndex,
        condtion: &Condition,
        tx: Sender<RowSet>,
    ) {
        match condtion {
            Condition::Activity(c) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::Activity(*c),
                    tx,
                );
            }
            Condition::Term(c) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::Term(c.clone()),
                    tx,
                );
            }
            Condition::Row(c) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::Row(c.clone()),
                    tx,
                );
            }
            Condition::Uuid(c) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::Uuid(c.clone()),
                    tx,
                );
            }
            Condition::LastUpdated(c) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::LastUpdated(c.clone()),
                    tx,
                );
            }
            Condition::Field(key, condition) => {
                VersatileDataSearch::search_exec_cond(
                    &collection.data,
                    &VersatileDataCondition::Field(key.to_owned(), condition.clone()),
                    tx,
                );
            }
            Condition::Depend(depend) => {
                let rel = relation.pends(depend.key(), depend.collection_row());
                let collection_id = collection.id();
                std::thread::spawn(move || {
                    let mut tmp = RowSet::default();
                    for r in rel {
                        if r.collection_id() == collection_id {
                            tmp.insert(r.row());
                        }
                    }
                    let tx = tx.clone();
                    tx.send(tmp).unwrap();
                });
            }
            Condition::Narrow(conditions) => {
                let (tx_inner, rx) = std::sync::mpsc::channel();
                for c in conditions {
                    let tx_inner = tx_inner.clone();
                    Self::exec_cond(collection, relation, c, tx_inner);
                }
                drop(tx_inner);
                std::thread::spawn(move || {
                    let mut is_1st = true;
                    let mut tmp = RowSet::default();
                    for mut rs in rx {
                        if is_1st {
                            tmp = rs;
                            is_1st = false;
                        } else {
                            tmp = tmp.intersection(&mut rs).map(|&x| x).collect();
                        }
                    }
                    tx.send(tmp).unwrap();
                });
            }
            Condition::Wide(conditions) => {
                let (tx_inner, rx) = std::sync::mpsc::channel();
                for c in conditions {
                    let tx_inner = tx_inner.clone();
                    Self::exec_cond(collection, relation, c, tx_inner);
                }
                drop(tx_inner);
                std::thread::spawn(move || {
                    let mut tmp = RowSet::default();
                    for ref mut rs in rx {
                        tmp.append(rs);
                    }
                    tx.send(tmp).unwrap();
                });
            }
        }
    }

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.