Skip to content

Conversation

@YohDeadfall
Copy link
Contributor

The reason behind that is that as_* methods doesn't consume self but a reference, and to_* methods do conversion by consuming self.

@vrmiguel
Copy link
Contributor

This doesn't conform to the Rust API guidelines.

"Conversions prefixed as_ and into_ typically decrease abstraction, either exposing a view into the underlying representation (as) or deconstructing data into its underlying representation (into).
Conversions prefixed to_, on the other hand, typically stay at the same level of abstraction but do some work to change from one representation to another."

@YohDeadfall
Copy link
Contributor Author

Hard to disagree, but there are many uses of to_ in std itself even for cheap things like to_bits. Saw the same thing in bevy too. Anyway, as there's a guideline, it's better to follow it. Thanks!

@YohDeadfall
Copy link
Contributor Author

Though maybe it's better to ask @workingjubilee first to avoid unnecessary changes.

@eeeebbbbrrrr
Copy link
Contributor

I appreciate the effort but I don't think this is a change we should make now. Perhaps when we get ready for a larger v0.14.0 with some breaking changes this could make sense, but in our current v0.13.x release series it seems like it'll be more detrimental to users than helpful.

@YohDeadfall
Copy link
Contributor Author

The thing here is that we need to decide how the method should be named as #2003 also does that too. As long as you are here, decide what's the correct option.

Copy link
Contributor

@eeeebbbbrrrr eeeebbbbrrrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm good with this. Thanks

@eeeebbbbrrrr eeeebbbbrrrr merged commit 30947fb into pgcentralfoundation:develop Apr 11, 2025
16 checks passed
@YohDeadfall YohDeadfall deleted the oid-to-u32 branch April 18, 2025 16:03
KenjiBrown pushed a commit to SoftwareLibreMx/pgrx that referenced this pull request May 27, 2025
The reason behind that is that `as_*` methods doesn't consume `self` but
a reference, and `to_*` methods do conversion by consuming `self`.
zhjwpku added a commit to zhjwpku/wrappers that referenced this pull request May 27, 2025
PostgreSQL 12 has been unsupported for over half a year,
and pgrx v0.14.0 officially dropped support for it.

The other reason I propose this version bumping is that
pgrx v0.12.9 failed to install pg 12 on my mac.

This patch removes PG12 support from the wrappers by
upgrading pgrx to v0.14.3. Some code adjustments were required
due to changes introduced in the newer pgrx versions.

For reference, see the following updates in pgrx:

- [force using extern "C-unwind" for functions marked with `#[pg_guard]`][1]
- [Made SPI query arguments type safe][2]
- [Added connect_mut for data changing SPI operations][3]
- [Renamed Oid::as_u32 to to_u32][4]

[1] pgcentralfoundation/pgrx#2014
[2] pgcentralfoundation/pgrx#1858
[3] pgcentralfoundation/pgrx#1913
[4] pgcentralfoundation/pgrx#2011

Signed-off-by: Junwang Zhao <[email protected]>
zhjwpku added a commit to zhjwpku/wrappers that referenced this pull request May 27, 2025
PostgreSQL 12 has been unsupported for over half a year,
and pgrx v0.14.0 officially dropped support for it.

The other reason I propose this version bumping is that
pgrx v0.12.9 failed to install pg 12 on my mac.

This patch removes PG12 support from the wrappers by
upgrading pgrx to v0.14.3. Some code adjustments were required
due to changes introduced in the newer pgrx versions.

For reference, see the following updates in pgrx:

- [force using extern "C-unwind" for functions marked with `#[pg_guard]`][1]
- [Made SPI query arguments type safe][2]
- [Added connect_mut for data changing SPI operations][3]
- [Renamed Oid::as_u32 to to_u32][4]

[1] pgcentralfoundation/pgrx#2014
[2] pgcentralfoundation/pgrx#1858
[3] pgcentralfoundation/pgrx#1913
[4] pgcentralfoundation/pgrx#2011

Signed-off-by: Junwang Zhao <[email protected]>
burmecia pushed a commit to supabase/wrappers that referenced this pull request May 28, 2025
* chore: bump pgrx to v0.14.3

PostgreSQL 12 has been unsupported for over half a year,
and pgrx v0.14.0 officially dropped support for it.

The other reason I propose this version bumping is that
pgrx v0.12.9 failed to install pg 12 on my mac.

This patch removes PG12 support from the wrappers by
upgrading pgrx to v0.14.3. Some code adjustments were required
due to changes introduced in the newer pgrx versions.

For reference, see the following updates in pgrx:

- [force using extern "C-unwind" for functions marked with `#[pg_guard]`][1]
- [Made SPI query arguments type safe][2]
- [Added connect_mut for data changing SPI operations][3]
- [Renamed Oid::as_u32 to to_u32][4]

[1] pgcentralfoundation/pgrx#2014
[2] pgcentralfoundation/pgrx#1858
[3] pgcentralfoundation/pgrx#1913
[4] pgcentralfoundation/pgrx#2011

Signed-off-by: Junwang Zhao <[email protected]>

* run cargo fmt

Signed-off-by: Junwang Zhao <[email protected]>

* bump ci cargp-pgrx version

Signed-off-by: Junwang Zhao <[email protected]>

---------

Signed-off-by: Junwang Zhao <[email protected]>
daamien pushed a commit to daamien/pgrx that referenced this pull request Dec 15, 2025
The reason behind that is that `as_*` methods doesn't consume `self` but
a reference, and `to_*` methods do conversion by consuming `self`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaks-API Hold for future release Hold for a future release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants