Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_mime_data(), set_mime_data() and supports_mime_type() to cario surface #220

Merged
merged 9 commits into from Nov 27, 2018

Conversation

Projects
None yet
4 participants
@jsparber
Copy link
Contributor

jsparber commented Nov 24, 2018

No description provided.

Show resolved Hide resolved src/surface.rs Outdated
Show resolved Hide resolved src/surface.rs Outdated

@jsparber jsparber force-pushed the jsparber:mime branch from 8c6a454 to a58b322 Nov 26, 2018

Show resolved Hide resolved src/surface.rs Outdated
Show resolved Hide resolved src/surface.rs Outdated
@jsparber

This comment has been minimized.

Copy link
Contributor Author

jsparber commented Nov 26, 2018

what should i use instead of to_glib_none() and ptr::null_mut(), since the CI fails because of them?

@jsparber

This comment has been minimized.

Copy link
Contributor Author

jsparber commented Nov 26, 2018

I think i fixed all indentation issues, but we really need rustfmt

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 26, 2018

what should i use instead of to_glib_none() and ptr::null_mut(), since the CI fails because of them?

The former is only available if cairo is built with glib support. You should use CStr / CString for strings, or where are the problems?

For ptr, that should work. How does it fail?

@jsparber

This comment has been minimized.

Copy link
Contributor Author

jsparber commented Nov 26, 2018

I didn't include ptr in surface, I guess cagro just got it from some where else. Anyhow it is fixed now. Also the CString thing.

@jsparber jsparber force-pushed the jsparber:mime branch 2 times, most recently from 0b4e748 to 4a4dda1 Nov 26, 2018

@jsparber

This comment has been minimized.

Copy link
Contributor Author

jsparber commented Nov 26, 2018

@sdroege std::ptr is included already inside the gvalue_impl macro, but this is used only when glib is enabled therefore the build fails if glib is disabled. How should I import in surface.rs?

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 26, 2018

@sdroege std::ptr is included already inside the gvalue_impl macro, but this is used only when glib is enabled therefore the build fails if glib is disabled. How should I import in surface.rs?

Just add a use statement for it? :)

@jsparber

This comment has been minimized.

Copy link
Contributor Author

jsparber commented Nov 26, 2018

@sdroege std::ptr is included already inside the gvalue_impl macro, but this is used only when glib is enabled therefore the build fails if glib is disabled. How should I import in surface.rs?

Just add a use statement for it? :)

Rust doesn't like to include it twice. I now added an annotation to the use statement to include std::ptr only when glib is disabled.

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 26, 2018

Rust doesn't like to include it twice. I now added an annotation to the use statement to include std::ptr only when glib is disabled.

You could remove the use statement from the macro (and use it as ::std::ptr::...).

@jsparber jsparber force-pushed the jsparber:mime branch from 7a5b4c2 to b3e0ece Nov 26, 2018

@jsparber

This comment has been minimized.

Copy link
Contributor Author

jsparber commented Nov 26, 2018

Rust doesn't like to include it twice. I now added an annotation to the use statement to include std::ptr only when glib is disabled.

You could remove the use statement from the macro (and use it as ::std::ptr::...).

i tried std::ptr before (which was wrong). let's hope it works now ;)

@jsparber jsparber force-pushed the jsparber:mime branch from b3e0ece to 6d1db39 Nov 26, 2018

Show resolved Hide resolved src/lib.rs Outdated
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 27, 2018

Looks good to me, but you might want to add an unsafe getter for the data too that does not copy. In librsvg you can ensure that the data stays valid all the time, and could prevent expensive copies that way.

@jsparber

This comment has been minimized.

Copy link
Contributor Author

jsparber commented Nov 27, 2018

just a unsave function which returns option<&[u8]>? Any ideas how i should name it? I thought about get_mime_data_raw()

@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 27, 2018

just a unsave function which returns option<&[u8]>? Any ideas how i should name it? I thought about get_mime_data_raw()

Sounds good to me

surface: add get_mime_data_raw()
get_mime_data_raw() returns the mime data without coping it to a new
location and therefore it is unsave
@sdroege

This comment has been minimized.

Copy link
Member

sdroege commented Nov 27, 2018

Seems good to me now

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

GuillaumeGomez commented Nov 27, 2018

Thanks!

@GuillaumeGomez GuillaumeGomez merged commit 41678ea into gtk-rs:master Nov 27, 2018

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.