Rename PgLTree::from to from_labels and add From<Vec<PgLTreeLabel>> implementation (#3949)

This commit is contained in:
jerryq 2025-08-22 13:11:35 +08:00 committed by GitHub
parent 0849fe3c5c
commit c01f51330a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -96,7 +96,7 @@ impl PgLTree {
}
/// creates ltree from a [`Vec<PgLTreeLabel>`]
pub fn from(labels: Vec<PgLTreeLabel>) -> Self {
pub fn from_labels(labels: Vec<PgLTreeLabel>) -> Self {
Self { labels }
}
@ -138,6 +138,12 @@ impl PgLTree {
}
}
impl From<Vec<PgLTreeLabel>> for PgLTree {
fn from(labels: Vec<PgLTreeLabel>) -> Self {
Self { labels }
}
}
impl FromIterator<PgLTreeLabel> for PgLTree {
fn from_iter<T: IntoIterator<Item = PgLTreeLabel>>(iter: T) -> Self {
Self {