rust


How safe is this behavior of GTK-rs Builder::get_object?


In The Rust Programming Language, it says something like:
Move semantics
There’s some more subtlety here, though: Rust ensures that there is
exactly one binding to any given resource. For example, if we have a
vector, we can assign it to another binding:
But I found that I can do this using gtk-rs:
let label1: gtk::Label = builder.get_object("label1").unwrap();
let label1_test: gtk::Label = builder.get_object("label1").unwrap();
Both now point to the same resource "or something happens to me."
Builder::get_object is defined as:
pub fn get_object<T: IsA<Object>>(&self, name: &str) -> Option<T> {
unsafe {
Option::<Object>::from_glib_none(
ffi::gtk_builder_get_object(self.to_glib_none().0, name.to_glib_none().0))
.and_then(|obj| obj.downcast().ok())
}
}
Although this is not really something from Rust directly, just from gtk-rs, I was wondering if I am right and how sure is this.
Maybe it could use Rc?

Related Links

How do I provide a default Debug implementation?
How to reverse map of objects to vector of tuples by using an iterator?
How do I create an empty byte array?
How to return a struct with a generic type that implements the `Read` and `Write` traits?
Unused type parameters when binding a generic type to a trait that takes lifetime
Rust borrow checker prevents reuse after end of scope [duplicate]
Why does removing println! cause a Windows API function called through FFI to fail?
How to increase lifetime of the bindings [duplicate]
Is Rust's lexical grammar regular, context-free or context-sensitive?
How do I change where `cargo install` places binaries?
How to convert hex string to a float in Rust?
How do I include the end value in a range?
What files in a Cargo project should be in my .gitignore?
Repeating a Rust task with tokio_timer
error: failed to run custom build command for `onig_sys v61.1.0`
Can't use lazy static integer constant for the size of an array

Categories

HOME
orientdb
apache-nifi
xcode
cucumber
exchange-server
applescript
add-on
ios-simulator
histogram
dronekit-python
moodle-api
elk-stack
tibco
linker
video-streaming
clone
javafx-8
native-base
hystrix
fasm
watch-os-3
responsivevoice
global-variables
vertica
fido-u2f
function-points
android-service
tf-idf
python-imageio
ccavenue
openbr
monitor
dotcms
tightvnc
publishing
python-2.x
mongoengine
markov-chains
apptentive
transform
xerces-c
twilio-php
android-alarms
gitolite
python-jira
robust
yoast
fluid-mac-app-engine
morphline
rightnow-crm
webalizer
aws-kinesis-firehose
password-hash
extjs4.1
sidewaffle
nsrunloop
always-on-top
openseadragon
wolfram-language
exists
xcopy
accessibilityservice
gulp-uglify
flipclock
currency-exchange-rates
trust
voronoi
enunciate
gdl
helm
blank-line
blockquote
bootstrap-wysiwyg
abstract-factory
gflags
phonegap-facebook-plugin
dnsjava
cakephp-2.2
ildasm
iplimage
redpitaya
sql-function
hotswap
usb-flash-drive
mod-perl
principalcontext
smips
strcmp
mute
mp4parser
coalesce
cgrectmake
popup-blocker
image-scanner
jzmq
data-dump
upshot
git-log
eaccelerator
ccl
urchin
principles
jboss-mdb

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App